proteus  1.7.4
C/C++/Fortran libraries
subsurfaceTransportFunctions.c
Go to the documentation of this file.
1 /* Generated by Cython 0.29.16 */
2 
3 #define PY_SSIZE_T_CLEAN
4 #include "Python.h"
5 #ifndef Py_PYTHON_H
6  #error Python headers needed to compile C extensions, please install development version of Python.
7 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
8  #error Cython requires Python 2.6+ or Python 3.3+.
9 #else
10 #define CYTHON_ABI "0_29_16"
11 #define CYTHON_HEX_VERSION 0x001D10F0
12 #define CYTHON_FUTURE_DIVISION 0
13 #include <stddef.h>
14 #ifndef offsetof
15  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
16 #endif
17 #if !defined(WIN32) && !defined(MS_WINDOWS)
18  #ifndef __stdcall
19  #define __stdcall
20  #endif
21  #ifndef __cdecl
22  #define __cdecl
23  #endif
24  #ifndef __fastcall
25  #define __fastcall
26  #endif
27 #endif
28 #ifndef DL_IMPORT
29  #define DL_IMPORT(t) t
30 #endif
31 #ifndef DL_EXPORT
32  #define DL_EXPORT(t) t
33 #endif
34 #define __PYX_COMMA ,
35 #ifndef HAVE_LONG_LONG
36  #if PY_VERSION_HEX >= 0x02070000
37  #define HAVE_LONG_LONG
38  #endif
39 #endif
40 #ifndef PY_LONG_LONG
41  #define PY_LONG_LONG LONG_LONG
42 #endif
43 #ifndef Py_HUGE_VAL
44  #define Py_HUGE_VAL HUGE_VAL
45 #endif
46 #ifdef PYPY_VERSION
47  #define CYTHON_COMPILING_IN_PYPY 1
48  #define CYTHON_COMPILING_IN_PYSTON 0
49  #define CYTHON_COMPILING_IN_CPYTHON 0
50  #undef CYTHON_USE_TYPE_SLOTS
51  #define CYTHON_USE_TYPE_SLOTS 0
52  #undef CYTHON_USE_PYTYPE_LOOKUP
53  #define CYTHON_USE_PYTYPE_LOOKUP 0
54  #if PY_VERSION_HEX < 0x03050000
55  #undef CYTHON_USE_ASYNC_SLOTS
56  #define CYTHON_USE_ASYNC_SLOTS 0
57  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
58  #define CYTHON_USE_ASYNC_SLOTS 1
59  #endif
60  #undef CYTHON_USE_PYLIST_INTERNALS
61  #define CYTHON_USE_PYLIST_INTERNALS 0
62  #undef CYTHON_USE_UNICODE_INTERNALS
63  #define CYTHON_USE_UNICODE_INTERNALS 0
64  #undef CYTHON_USE_UNICODE_WRITER
65  #define CYTHON_USE_UNICODE_WRITER 0
66  #undef CYTHON_USE_PYLONG_INTERNALS
67  #define CYTHON_USE_PYLONG_INTERNALS 0
68  #undef CYTHON_AVOID_BORROWED_REFS
69  #define CYTHON_AVOID_BORROWED_REFS 1
70  #undef CYTHON_ASSUME_SAFE_MACROS
71  #define CYTHON_ASSUME_SAFE_MACROS 0
72  #undef CYTHON_UNPACK_METHODS
73  #define CYTHON_UNPACK_METHODS 0
74  #undef CYTHON_FAST_THREAD_STATE
75  #define CYTHON_FAST_THREAD_STATE 0
76  #undef CYTHON_FAST_PYCALL
77  #define CYTHON_FAST_PYCALL 0
78  #undef CYTHON_PEP489_MULTI_PHASE_INIT
79  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
80  #undef CYTHON_USE_TP_FINALIZE
81  #define CYTHON_USE_TP_FINALIZE 0
82  #undef CYTHON_USE_DICT_VERSIONS
83  #define CYTHON_USE_DICT_VERSIONS 0
84  #undef CYTHON_USE_EXC_INFO_STACK
85  #define CYTHON_USE_EXC_INFO_STACK 0
86 #elif defined(PYSTON_VERSION)
87  #define CYTHON_COMPILING_IN_PYPY 0
88  #define CYTHON_COMPILING_IN_PYSTON 1
89  #define CYTHON_COMPILING_IN_CPYTHON 0
90  #ifndef CYTHON_USE_TYPE_SLOTS
91  #define CYTHON_USE_TYPE_SLOTS 1
92  #endif
93  #undef CYTHON_USE_PYTYPE_LOOKUP
94  #define CYTHON_USE_PYTYPE_LOOKUP 0
95  #undef CYTHON_USE_ASYNC_SLOTS
96  #define CYTHON_USE_ASYNC_SLOTS 0
97  #undef CYTHON_USE_PYLIST_INTERNALS
98  #define CYTHON_USE_PYLIST_INTERNALS 0
99  #ifndef CYTHON_USE_UNICODE_INTERNALS
100  #define CYTHON_USE_UNICODE_INTERNALS 1
101  #endif
102  #undef CYTHON_USE_UNICODE_WRITER
103  #define CYTHON_USE_UNICODE_WRITER 0
104  #undef CYTHON_USE_PYLONG_INTERNALS
105  #define CYTHON_USE_PYLONG_INTERNALS 0
106  #ifndef CYTHON_AVOID_BORROWED_REFS
107  #define CYTHON_AVOID_BORROWED_REFS 0
108  #endif
109  #ifndef CYTHON_ASSUME_SAFE_MACROS
110  #define CYTHON_ASSUME_SAFE_MACROS 1
111  #endif
112  #ifndef CYTHON_UNPACK_METHODS
113  #define CYTHON_UNPACK_METHODS 1
114  #endif
115  #undef CYTHON_FAST_THREAD_STATE
116  #define CYTHON_FAST_THREAD_STATE 0
117  #undef CYTHON_FAST_PYCALL
118  #define CYTHON_FAST_PYCALL 0
119  #undef CYTHON_PEP489_MULTI_PHASE_INIT
120  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
121  #undef CYTHON_USE_TP_FINALIZE
122  #define CYTHON_USE_TP_FINALIZE 0
123  #undef CYTHON_USE_DICT_VERSIONS
124  #define CYTHON_USE_DICT_VERSIONS 0
125  #undef CYTHON_USE_EXC_INFO_STACK
126  #define CYTHON_USE_EXC_INFO_STACK 0
127 #else
128  #define CYTHON_COMPILING_IN_PYPY 0
129  #define CYTHON_COMPILING_IN_PYSTON 0
130  #define CYTHON_COMPILING_IN_CPYTHON 1
131  #ifndef CYTHON_USE_TYPE_SLOTS
132  #define CYTHON_USE_TYPE_SLOTS 1
133  #endif
134  #if PY_VERSION_HEX < 0x02070000
135  #undef CYTHON_USE_PYTYPE_LOOKUP
136  #define CYTHON_USE_PYTYPE_LOOKUP 0
137  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
138  #define CYTHON_USE_PYTYPE_LOOKUP 1
139  #endif
140  #if PY_MAJOR_VERSION < 3
141  #undef CYTHON_USE_ASYNC_SLOTS
142  #define CYTHON_USE_ASYNC_SLOTS 0
143  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
144  #define CYTHON_USE_ASYNC_SLOTS 1
145  #endif
146  #if PY_VERSION_HEX < 0x02070000
147  #undef CYTHON_USE_PYLONG_INTERNALS
148  #define CYTHON_USE_PYLONG_INTERNALS 0
149  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
150  #define CYTHON_USE_PYLONG_INTERNALS 1
151  #endif
152  #ifndef CYTHON_USE_PYLIST_INTERNALS
153  #define CYTHON_USE_PYLIST_INTERNALS 1
154  #endif
155  #ifndef CYTHON_USE_UNICODE_INTERNALS
156  #define CYTHON_USE_UNICODE_INTERNALS 1
157  #endif
158  #if PY_VERSION_HEX < 0x030300F0
159  #undef CYTHON_USE_UNICODE_WRITER
160  #define CYTHON_USE_UNICODE_WRITER 0
161  #elif !defined(CYTHON_USE_UNICODE_WRITER)
162  #define CYTHON_USE_UNICODE_WRITER 1
163  #endif
164  #ifndef CYTHON_AVOID_BORROWED_REFS
165  #define CYTHON_AVOID_BORROWED_REFS 0
166  #endif
167  #ifndef CYTHON_ASSUME_SAFE_MACROS
168  #define CYTHON_ASSUME_SAFE_MACROS 1
169  #endif
170  #ifndef CYTHON_UNPACK_METHODS
171  #define CYTHON_UNPACK_METHODS 1
172  #endif
173  #ifndef CYTHON_FAST_THREAD_STATE
174  #define CYTHON_FAST_THREAD_STATE 1
175  #endif
176  #ifndef CYTHON_FAST_PYCALL
177  #define CYTHON_FAST_PYCALL 1
178  #endif
179  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
180  #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
181  #endif
182  #ifndef CYTHON_USE_TP_FINALIZE
183  #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
184  #endif
185  #ifndef CYTHON_USE_DICT_VERSIONS
186  #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
187  #endif
188  #ifndef CYTHON_USE_EXC_INFO_STACK
189  #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
190  #endif
191 #endif
192 #if !defined(CYTHON_FAST_PYCCALL)
193 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
194 #endif
195 #if CYTHON_USE_PYLONG_INTERNALS
196  #include "longintrepr.h"
197  #undef SHIFT
198  #undef BASE
199  #undef MASK
200  #ifdef SIZEOF_VOID_P
201  enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
202  #endif
203 #endif
204 #ifndef __has_attribute
205  #define __has_attribute(x) 0
206 #endif
207 #ifndef __has_cpp_attribute
208  #define __has_cpp_attribute(x) 0
209 #endif
210 #ifndef CYTHON_RESTRICT
211  #if defined(__GNUC__)
212  #define CYTHON_RESTRICT __restrict__
213  #elif defined(_MSC_VER) && _MSC_VER >= 1400
214  #define CYTHON_RESTRICT __restrict
215  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
216  #define CYTHON_RESTRICT restrict
217  #else
218  #define CYTHON_RESTRICT
219  #endif
220 #endif
221 #ifndef CYTHON_UNUSED
222 # if defined(__GNUC__)
223 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
224 # define CYTHON_UNUSED __attribute__ ((__unused__))
225 # else
226 # define CYTHON_UNUSED
227 # endif
228 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
229 # define CYTHON_UNUSED __attribute__ ((__unused__))
230 # else
231 # define CYTHON_UNUSED
232 # endif
233 #endif
234 #ifndef CYTHON_MAYBE_UNUSED_VAR
235 # if defined(__cplusplus)
236  template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
237 # else
238 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
239 # endif
240 #endif
241 #ifndef CYTHON_NCP_UNUSED
242 # if CYTHON_COMPILING_IN_CPYTHON
243 # define CYTHON_NCP_UNUSED
244 # else
245 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
246 # endif
247 #endif
248 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
249 #ifdef _MSC_VER
250  #ifndef _MSC_STDINT_H_
251  #if _MSC_VER < 1300
252  typedef unsigned char uint8_t;
253  typedef unsigned int uint32_t;
254  #else
255  typedef unsigned __int8 uint8_t;
256  typedef unsigned __int32 uint32_t;
257  #endif
258  #endif
259 #else
260  #include <stdint.h>
261 #endif
262 #ifndef CYTHON_FALLTHROUGH
263  #if defined(__cplusplus) && __cplusplus >= 201103L
264  #if __has_cpp_attribute(fallthrough)
265  #define CYTHON_FALLTHROUGH [[fallthrough]]
266  #elif __has_cpp_attribute(clang::fallthrough)
267  #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
268  #elif __has_cpp_attribute(gnu::fallthrough)
269  #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
270  #endif
271  #endif
272  #ifndef CYTHON_FALLTHROUGH
273  #if __has_attribute(fallthrough)
274  #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
275  #else
276  #define CYTHON_FALLTHROUGH
277  #endif
278  #endif
279  #if defined(__clang__ ) && defined(__apple_build_version__)
280  #if __apple_build_version__ < 7000000
281  #undef CYTHON_FALLTHROUGH
282  #define CYTHON_FALLTHROUGH
283  #endif
284  #endif
285 #endif
286 
287 #ifndef CYTHON_INLINE
288  #if defined(__clang__)
289  #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
290  #elif defined(__GNUC__)
291  #define CYTHON_INLINE __inline__
292  #elif defined(_MSC_VER)
293  #define CYTHON_INLINE __inline
294  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
295  #define CYTHON_INLINE inline
296  #else
297  #define CYTHON_INLINE
298  #endif
299 #endif
300 
301 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
302  #define Py_OptimizeFlag 0
303 #endif
304 #define __PYX_BUILD_PY_SSIZE_T "n"
305 #define CYTHON_FORMAT_SSIZE_T "z"
306 #if PY_MAJOR_VERSION < 3
307  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
308  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
309  PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
310  #define __Pyx_DefaultClassType PyClass_Type
311 #else
312  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
313 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
314  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
315  PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
316 #else
317  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
318  PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
319 #endif
320  #define __Pyx_DefaultClassType PyType_Type
321 #endif
322 #ifndef Py_TPFLAGS_CHECKTYPES
323  #define Py_TPFLAGS_CHECKTYPES 0
324 #endif
325 #ifndef Py_TPFLAGS_HAVE_INDEX
326  #define Py_TPFLAGS_HAVE_INDEX 0
327 #endif
328 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
329  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
330 #endif
331 #ifndef Py_TPFLAGS_HAVE_FINALIZE
332  #define Py_TPFLAGS_HAVE_FINALIZE 0
333 #endif
334 #ifndef METH_STACKLESS
335  #define METH_STACKLESS 0
336 #endif
337 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
338  #ifndef METH_FASTCALL
339  #define METH_FASTCALL 0x80
340  #endif
341  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
342  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
343  Py_ssize_t nargs, PyObject *kwnames);
344 #else
345  #define __Pyx_PyCFunctionFast _PyCFunctionFast
346  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
347 #endif
348 #if CYTHON_FAST_PYCCALL
349 #define __Pyx_PyFastCFunction_Check(func)\
350  ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
351 #else
352 #define __Pyx_PyFastCFunction_Check(func) 0
353 #endif
354 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
355  #define PyObject_Malloc(s) PyMem_Malloc(s)
356  #define PyObject_Free(p) PyMem_Free(p)
357  #define PyObject_Realloc(p) PyMem_Realloc(p)
358 #endif
359 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
360  #define PyMem_RawMalloc(n) PyMem_Malloc(n)
361  #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
362  #define PyMem_RawFree(p) PyMem_Free(p)
363 #endif
364 #if CYTHON_COMPILING_IN_PYSTON
365  #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
366  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
367 #else
368  #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
369  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
370 #endif
371 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
372  #define __Pyx_PyThreadState_Current PyThreadState_GET()
373 #elif PY_VERSION_HEX >= 0x03060000
374  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
375 #elif PY_VERSION_HEX >= 0x03000000
376  #define __Pyx_PyThreadState_Current PyThreadState_GET()
377 #else
378  #define __Pyx_PyThreadState_Current _PyThreadState_Current
379 #endif
380 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
381 #include "pythread.h"
382 #define Py_tss_NEEDS_INIT 0
383 typedef int Py_tss_t;
384 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
385  *key = PyThread_create_key();
386  return 0;
387 }
388 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
389  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
390  *key = Py_tss_NEEDS_INIT;
391  return key;
392 }
393 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
394  PyObject_Free(key);
395 }
396 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
397  return *key != Py_tss_NEEDS_INIT;
398 }
399 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
400  PyThread_delete_key(*key);
401  *key = Py_tss_NEEDS_INIT;
402 }
403 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
404  return PyThread_set_key_value(*key, value);
405 }
406 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
407  return PyThread_get_key_value(*key);
408 }
409 #endif
410 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
411 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
412 #else
413 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
414 #endif
415 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
416  #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
417  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
418 #else
419  #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
420  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
421 #endif
422 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
423 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
424 #else
425 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
426 #endif
427 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
428  #define CYTHON_PEP393_ENABLED 1
429  #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
430  0 : _PyUnicode_Ready((PyObject *)(op)))
431  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
432  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
433  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
434  #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
435  #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
436  #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
437  #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
438  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
439 #else
440  #define CYTHON_PEP393_ENABLED 0
441  #define PyUnicode_1BYTE_KIND 1
442  #define PyUnicode_2BYTE_KIND 2
443  #define PyUnicode_4BYTE_KIND 4
444  #define __Pyx_PyUnicode_READY(op) (0)
445  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
446  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
447  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
448  #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
449  #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
450  #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
451  #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
452  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
453 #endif
454 #if CYTHON_COMPILING_IN_PYPY
455  #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
456  #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
457 #else
458  #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
459  #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
460  PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
461 #endif
462 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
463  #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
464 #endif
465 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
466  #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
467 #endif
468 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
469  #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
470 #endif
471 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
472 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
473 #if PY_MAJOR_VERSION >= 3
474  #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
475 #else
476  #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
477 #endif
478 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
479  #define PyObject_ASCII(o) PyObject_Repr(o)
480 #endif
481 #if PY_MAJOR_VERSION >= 3
482  #define PyBaseString_Type PyUnicode_Type
483  #define PyStringObject PyUnicodeObject
484  #define PyString_Type PyUnicode_Type
485  #define PyString_Check PyUnicode_Check
486  #define PyString_CheckExact PyUnicode_CheckExact
487 #ifndef PyObject_Unicode
488  #define PyObject_Unicode PyObject_Str
489 #endif
490 #endif
491 #if PY_MAJOR_VERSION >= 3
492  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
493  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
494 #else
495  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
496  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
497 #endif
498 #ifndef PySet_CheckExact
499  #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
500 #endif
501 #if CYTHON_ASSUME_SAFE_MACROS
502  #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
503 #else
504  #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
505 #endif
506 #if PY_MAJOR_VERSION >= 3
507  #define PyIntObject PyLongObject
508  #define PyInt_Type PyLong_Type
509  #define PyInt_Check(op) PyLong_Check(op)
510  #define PyInt_CheckExact(op) PyLong_CheckExact(op)
511  #define PyInt_FromString PyLong_FromString
512  #define PyInt_FromUnicode PyLong_FromUnicode
513  #define PyInt_FromLong PyLong_FromLong
514  #define PyInt_FromSize_t PyLong_FromSize_t
515  #define PyInt_FromSsize_t PyLong_FromSsize_t
516  #define PyInt_AsLong PyLong_AsLong
517  #define PyInt_AS_LONG PyLong_AS_LONG
518  #define PyInt_AsSsize_t PyLong_AsSsize_t
519  #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
520  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
521  #define PyNumber_Int PyNumber_Long
522 #endif
523 #if PY_MAJOR_VERSION >= 3
524  #define PyBoolObject PyLongObject
525 #endif
526 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
527  #ifndef PyUnicode_InternFromString
528  #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
529  #endif
530 #endif
531 #if PY_VERSION_HEX < 0x030200A4
532  typedef long Py_hash_t;
533  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
534  #define __Pyx_PyInt_AsHash_t PyInt_AsLong
535 #else
536  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
537  #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
538 #endif
539 #if PY_MAJOR_VERSION >= 3
540  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
541 #else
542  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
543 #endif
544 #if CYTHON_USE_ASYNC_SLOTS
545  #if PY_VERSION_HEX >= 0x030500B1
546  #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
547  #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
548  #else
549  #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
550  #endif
551 #else
552  #define __Pyx_PyType_AsAsync(obj) NULL
553 #endif
554 #ifndef __Pyx_PyAsyncMethodsStruct
555  typedef struct {
556  unaryfunc am_await;
557  unaryfunc am_aiter;
558  unaryfunc am_anext;
559  } __Pyx_PyAsyncMethodsStruct;
560 #endif
561 
562 #if defined(WIN32) || defined(MS_WINDOWS)
563  #define _USE_MATH_DEFINES
564 #endif
565 #include <math.h>
566 #ifdef NAN
567 #define __PYX_NAN() ((float) NAN)
568 #else
569 static CYTHON_INLINE float __PYX_NAN() {
570  float value;
571  memset(&value, 0xFF, sizeof(value));
572  return value;
573 }
574 #endif
575 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
576 #define __Pyx_truncl trunc
577 #else
578 #define __Pyx_truncl truncl
579 #endif
580 
581 
582 #define __PYX_ERR(f_index, lineno, Ln_error) \
583 { \
584  __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
585 }
586 
587 #ifndef __PYX_EXTERN_C
588  #ifdef __cplusplus
589  #define __PYX_EXTERN_C extern "C"
590  #else
591  #define __PYX_EXTERN_C extern
592  #endif
593 #endif
594 
595 #define __PYX_HAVE__subsurfaceTransportFunctions
596 #define __PYX_HAVE_API__subsurfaceTransportFunctions
597 /* Early includes */
598 #include <string.h>
599 #include <stdio.h>
600 #include "numpy/arrayobject.h"
601 #include "numpy/ufuncobject.h"
602 #include "math.h"
603 #ifdef _OPENMP
604 #include <omp.h>
605 #endif /* _OPENMP */
606 
607 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
608 #define CYTHON_WITHOUT_ASSERTIONS
609 #endif
610 
611 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
612  const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
613 
614 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
615 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
616 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
617 #define __PYX_DEFAULT_STRING_ENCODING ""
618 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
619 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
620 #define __Pyx_uchar_cast(c) ((unsigned char)c)
621 #define __Pyx_long_cast(x) ((long)x)
622 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
623  (sizeof(type) < sizeof(Py_ssize_t)) ||\
624  (sizeof(type) > sizeof(Py_ssize_t) &&\
625  likely(v < (type)PY_SSIZE_T_MAX ||\
626  v == (type)PY_SSIZE_T_MAX) &&\
627  (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
628  v == (type)PY_SSIZE_T_MIN))) ||\
629  (sizeof(type) == sizeof(Py_ssize_t) &&\
630  (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
631  v == (type)PY_SSIZE_T_MAX))) )
632 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
633  return (size_t) i < (size_t) limit;
634 }
635 #if defined (__cplusplus) && __cplusplus >= 201103L
636  #include <cstdlib>
637  #define __Pyx_sst_abs(value) std::abs(value)
638 #elif SIZEOF_INT >= SIZEOF_SIZE_T
639  #define __Pyx_sst_abs(value) abs(value)
640 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
641  #define __Pyx_sst_abs(value) labs(value)
642 #elif defined (_MSC_VER)
643  #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
644 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
645  #define __Pyx_sst_abs(value) llabs(value)
646 #elif defined (__GNUC__)
647  #define __Pyx_sst_abs(value) __builtin_llabs(value)
648 #else
649  #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
650 #endif
651 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
652 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
653 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
654 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
655 #define __Pyx_PyBytes_FromString PyBytes_FromString
656 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
657 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
658 #if PY_MAJOR_VERSION < 3
659  #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
660  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
661 #else
662  #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
663  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
664 #endif
665 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
666 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
667 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
668 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
669 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
670 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
671 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
672 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
673 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
674 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
675 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
676 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
677 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
678 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
679 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
680 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
681 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
682  const Py_UNICODE *u_end = u;
683  while (*u_end++) ;
684  return (size_t)(u_end - u - 1);
685 }
686 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
687 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
688 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
689 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
690 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
691 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
692 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
693 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
694 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
695 #define __Pyx_PySequence_Tuple(obj)\
696  (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
697 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
698 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
699 #if CYTHON_ASSUME_SAFE_MACROS
700 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
701 #else
702 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
703 #endif
704 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
705 #if PY_MAJOR_VERSION >= 3
706 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
707 #else
708 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
709 #endif
710 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
711 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
712 static int __Pyx_sys_getdefaultencoding_not_ascii;
713 static int __Pyx_init_sys_getdefaultencoding_params(void) {
714  PyObject* sys;
715  PyObject* default_encoding = NULL;
716  PyObject* ascii_chars_u = NULL;
717  PyObject* ascii_chars_b = NULL;
718  const char* default_encoding_c;
719  sys = PyImport_ImportModule("sys");
720  if (!sys) goto bad;
721  default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
722  Py_DECREF(sys);
723  if (!default_encoding) goto bad;
724  default_encoding_c = PyBytes_AsString(default_encoding);
725  if (!default_encoding_c) goto bad;
726  if (strcmp(default_encoding_c, "ascii") == 0) {
727  __Pyx_sys_getdefaultencoding_not_ascii = 0;
728  } else {
729  char ascii_chars[128];
730  int c;
731  for (c = 0; c < 128; c++) {
732  ascii_chars[c] = c;
733  }
734  __Pyx_sys_getdefaultencoding_not_ascii = 1;
735  ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
736  if (!ascii_chars_u) goto bad;
737  ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
738  if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
739  PyErr_Format(
740  PyExc_ValueError,
741  "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
742  default_encoding_c);
743  goto bad;
744  }
745  Py_DECREF(ascii_chars_u);
746  Py_DECREF(ascii_chars_b);
747  }
748  Py_DECREF(default_encoding);
749  return 0;
750 bad:
751  Py_XDECREF(default_encoding);
752  Py_XDECREF(ascii_chars_u);
753  Py_XDECREF(ascii_chars_b);
754  return -1;
755 }
756 #endif
757 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
758 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
759 #else
760 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
761 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
762 static char* __PYX_DEFAULT_STRING_ENCODING;
763 static int __Pyx_init_sys_getdefaultencoding_params(void) {
764  PyObject* sys;
765  PyObject* default_encoding = NULL;
766  char* default_encoding_c;
767  sys = PyImport_ImportModule("sys");
768  if (!sys) goto bad;
769  default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
770  Py_DECREF(sys);
771  if (!default_encoding) goto bad;
772  default_encoding_c = PyBytes_AsString(default_encoding);
773  if (!default_encoding_c) goto bad;
774  __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
775  if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
776  strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
777  Py_DECREF(default_encoding);
778  return 0;
779 bad:
780  Py_XDECREF(default_encoding);
781  return -1;
782 }
783 #endif
784 #endif
785 
786 
787 /* Test for GCC > 2.95 */
788 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
789  #define likely(x) __builtin_expect(!!(x), 1)
790  #define unlikely(x) __builtin_expect(!!(x), 0)
791 #else /* !__GNUC__ or GCC < 2.95 */
792  #define likely(x) (x)
793  #define unlikely(x) (x)
794 #endif /* __GNUC__ */
795 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
796 
797 static PyObject *__pyx_m = NULL;
798 static PyObject *__pyx_d;
799 static PyObject *__pyx_b;
800 static PyObject *__pyx_cython_runtime = NULL;
801 static PyObject *__pyx_empty_tuple;
802 static PyObject *__pyx_empty_bytes;
803 static PyObject *__pyx_empty_unicode;
804 static int __pyx_lineno;
805 static int __pyx_clineno = 0;
806 static const char * __pyx_cfilenm= __FILE__;
807 static const char *__pyx_filename;
808 
809 /* Header.proto */
810 #if !defined(CYTHON_CCOMPLEX)
811  #if defined(__cplusplus)
812  #define CYTHON_CCOMPLEX 1
813  #elif defined(_Complex_I)
814  #define CYTHON_CCOMPLEX 1
815  #else
816  #define CYTHON_CCOMPLEX 0
817  #endif
818 #endif
819 #if CYTHON_CCOMPLEX
820  #ifdef __cplusplus
821  #include <complex>
822  #else
823  #include <complex.h>
824  #endif
825 #endif
826 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
827  #undef _Complex_I
828  #define _Complex_I 1.0fj
829 #endif
830 
831 
832 static const char *__pyx_f[] = {
833  "proteus/subsurfaceTransportFunctions.pyx",
834  "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd",
835  "linux/lib/python3.7/site-packages/Cython/Includes/cpython/type.pxd",
836 };
837 /* BufferFormatStructs.proto */
838 #define IS_UNSIGNED(type) (((type) -1) > 0)
839 struct __Pyx_StructField_;
840 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
841 typedef struct {
842  const char* name;
843  struct __Pyx_StructField_* fields;
844  size_t size;
845  size_t arraysize[8];
846  int ndim;
847  char typegroup;
848  char is_unsigned;
849  int flags;
850 } __Pyx_TypeInfo;
851 typedef struct __Pyx_StructField_ {
852  __Pyx_TypeInfo* type;
853  const char* name;
854  size_t offset;
855 } __Pyx_StructField;
856 typedef struct {
857  __Pyx_StructField* field;
858  size_t parent_offset;
859 } __Pyx_BufFmt_StackElem;
860 typedef struct {
861  __Pyx_StructField root;
862  __Pyx_BufFmt_StackElem* head;
863  size_t fmt_offset;
864  size_t new_count, enc_count;
865  size_t struct_alignment;
866  int is_complex;
867  char enc_type;
868  char new_packmode;
869  char enc_packmode;
870  char is_valid_array;
871 } __Pyx_BufFmt_Context;
872 
873 
874 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":776
875  * # in Cython to enable them only on the right systems.
876  *
877  * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
878  * ctypedef npy_int16 int16_t
879  * ctypedef npy_int32 int32_t
880  */
881 typedef npy_int8 __pyx_t_5numpy_int8_t;
882 
883 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":777
884  *
885  * ctypedef npy_int8 int8_t
886  * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
887  * ctypedef npy_int32 int32_t
888  * ctypedef npy_int64 int64_t
889  */
890 typedef npy_int16 __pyx_t_5numpy_int16_t;
891 
892 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":778
893  * ctypedef npy_int8 int8_t
894  * ctypedef npy_int16 int16_t
895  * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
896  * ctypedef npy_int64 int64_t
897  * #ctypedef npy_int96 int96_t
898  */
899 typedef npy_int32 __pyx_t_5numpy_int32_t;
900 
901 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":779
902  * ctypedef npy_int16 int16_t
903  * ctypedef npy_int32 int32_t
904  * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
905  * #ctypedef npy_int96 int96_t
906  * #ctypedef npy_int128 int128_t
907  */
908 typedef npy_int64 __pyx_t_5numpy_int64_t;
909 
910 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":783
911  * #ctypedef npy_int128 int128_t
912  *
913  * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
914  * ctypedef npy_uint16 uint16_t
915  * ctypedef npy_uint32 uint32_t
916  */
917 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
918 
919 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":784
920  *
921  * ctypedef npy_uint8 uint8_t
922  * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
923  * ctypedef npy_uint32 uint32_t
924  * ctypedef npy_uint64 uint64_t
925  */
926 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
927 
928 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":785
929  * ctypedef npy_uint8 uint8_t
930  * ctypedef npy_uint16 uint16_t
931  * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
932  * ctypedef npy_uint64 uint64_t
933  * #ctypedef npy_uint96 uint96_t
934  */
935 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
936 
937 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":786
938  * ctypedef npy_uint16 uint16_t
939  * ctypedef npy_uint32 uint32_t
940  * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
941  * #ctypedef npy_uint96 uint96_t
942  * #ctypedef npy_uint128 uint128_t
943  */
944 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
945 
946 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":790
947  * #ctypedef npy_uint128 uint128_t
948  *
949  * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
950  * ctypedef npy_float64 float64_t
951  * #ctypedef npy_float80 float80_t
952  */
953 typedef npy_float32 __pyx_t_5numpy_float32_t;
954 
955 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":791
956  *
957  * ctypedef npy_float32 float32_t
958  * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
959  * #ctypedef npy_float80 float80_t
960  * #ctypedef npy_float128 float128_t
961  */
962 typedef npy_float64 __pyx_t_5numpy_float64_t;
963 
964 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":800
965  * # The int types are mapped a bit surprising --
966  * # numpy.int corresponds to 'l' and numpy.long to 'q'
967  * ctypedef npy_long int_t # <<<<<<<<<<<<<<
968  * ctypedef npy_longlong long_t
969  * ctypedef npy_longlong longlong_t
970  */
971 typedef npy_long __pyx_t_5numpy_int_t;
972 
973 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":801
974  * # numpy.int corresponds to 'l' and numpy.long to 'q'
975  * ctypedef npy_long int_t
976  * ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
977  * ctypedef npy_longlong longlong_t
978  *
979  */
980 typedef npy_longlong __pyx_t_5numpy_long_t;
981 
982 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":802
983  * ctypedef npy_long int_t
984  * ctypedef npy_longlong long_t
985  * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
986  *
987  * ctypedef npy_ulong uint_t
988  */
989 typedef npy_longlong __pyx_t_5numpy_longlong_t;
990 
991 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":804
992  * ctypedef npy_longlong longlong_t
993  *
994  * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
995  * ctypedef npy_ulonglong ulong_t
996  * ctypedef npy_ulonglong ulonglong_t
997  */
998 typedef npy_ulong __pyx_t_5numpy_uint_t;
999 
1000 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":805
1001  *
1002  * ctypedef npy_ulong uint_t
1003  * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
1004  * ctypedef npy_ulonglong ulonglong_t
1005  *
1006  */
1007 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1008 
1009 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":806
1010  * ctypedef npy_ulong uint_t
1011  * ctypedef npy_ulonglong ulong_t
1012  * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
1013  *
1014  * ctypedef npy_intp intp_t
1015  */
1016 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1017 
1018 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":808
1019  * ctypedef npy_ulonglong ulonglong_t
1020  *
1021  * ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
1022  * ctypedef npy_uintp uintp_t
1023  *
1024  */
1025 typedef npy_intp __pyx_t_5numpy_intp_t;
1026 
1027 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":809
1028  *
1029  * ctypedef npy_intp intp_t
1030  * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
1031  *
1032  * ctypedef npy_double float_t
1033  */
1034 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1035 
1036 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":811
1037  * ctypedef npy_uintp uintp_t
1038  *
1039  * ctypedef npy_double float_t # <<<<<<<<<<<<<<
1040  * ctypedef npy_double double_t
1041  * ctypedef npy_longdouble longdouble_t
1042  */
1043 typedef npy_double __pyx_t_5numpy_float_t;
1044 
1045 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":812
1046  *
1047  * ctypedef npy_double float_t
1048  * ctypedef npy_double double_t # <<<<<<<<<<<<<<
1049  * ctypedef npy_longdouble longdouble_t
1050  *
1051  */
1052 typedef npy_double __pyx_t_5numpy_double_t;
1053 
1054 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":813
1055  * ctypedef npy_double float_t
1056  * ctypedef npy_double double_t
1057  * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
1058  *
1059  * ctypedef npy_cfloat cfloat_t
1060  */
1061 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1062 
1063 /* "subsurfaceTransportFunctions.pyx":14
1064  * cdef inline double double_min(double a, double b): return a if a <= b else b
1065  *
1066  * ctypedef numpy.double_t DTYPE_t # <<<<<<<<<<<<<<
1067  * #numpy.intc_t not in cython's numpy.pxd
1068  * ctypedef int ITYPE_t
1069  */
1070 typedef __pyx_t_5numpy_double_t __pyx_t_28subsurfaceTransportFunctions_DTYPE_t;
1071 
1072 /* "subsurfaceTransportFunctions.pyx":16
1073  * ctypedef numpy.double_t DTYPE_t
1074  * #numpy.intc_t not in cython's numpy.pxd
1075  * ctypedef int ITYPE_t # <<<<<<<<<<<<<<
1076  *
1077  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global,
1078  */
1079 typedef int __pyx_t_28subsurfaceTransportFunctions_ITYPE_t;
1080 /* Declarations.proto */
1081 #if CYTHON_CCOMPLEX
1082  #ifdef __cplusplus
1083  typedef ::std::complex< float > __pyx_t_float_complex;
1084  #else
1085  typedef float _Complex __pyx_t_float_complex;
1086  #endif
1087 #else
1088  typedef struct { float real, imag; } __pyx_t_float_complex;
1089 #endif
1090 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1091 
1092 /* Declarations.proto */
1093 #if CYTHON_CCOMPLEX
1094  #ifdef __cplusplus
1095  typedef ::std::complex< double > __pyx_t_double_complex;
1096  #else
1097  typedef double _Complex __pyx_t_double_complex;
1098  #endif
1099 #else
1100  typedef struct { double real, imag; } __pyx_t_double_complex;
1101 #endif
1102 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1103 
1104 
1105 /*--- Type declarations ---*/
1106 
1107 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":815
1108  * ctypedef npy_longdouble longdouble_t
1109  *
1110  * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
1111  * ctypedef npy_cdouble cdouble_t
1112  * ctypedef npy_clongdouble clongdouble_t
1113  */
1114 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1115 
1116 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":816
1117  *
1118  * ctypedef npy_cfloat cfloat_t
1119  * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
1120  * ctypedef npy_clongdouble clongdouble_t
1121  *
1122  */
1123 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1124 
1125 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":817
1126  * ctypedef npy_cfloat cfloat_t
1127  * ctypedef npy_cdouble cdouble_t
1128  * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
1129  *
1130  * ctypedef npy_cdouble complex_t
1131  */
1132 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1133 
1134 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":819
1135  * ctypedef npy_clongdouble clongdouble_t
1136  *
1137  * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
1138  *
1139  * cdef inline object PyArray_MultiIterNew1(a):
1140  */
1141 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1142 
1143 /* --- Runtime support code (head) --- */
1144 /* Refnanny.proto */
1145 #ifndef CYTHON_REFNANNY
1146  #define CYTHON_REFNANNY 0
1147 #endif
1148 #if CYTHON_REFNANNY
1149  typedef struct {
1150  void (*INCREF)(void*, PyObject*, int);
1151  void (*DECREF)(void*, PyObject*, int);
1152  void (*GOTREF)(void*, PyObject*, int);
1153  void (*GIVEREF)(void*, PyObject*, int);
1154  void* (*SetupContext)(const char*, int, const char*);
1155  void (*FinishContext)(void**);
1156  } __Pyx_RefNannyAPIStruct;
1157  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1158  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1159  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1160 #ifdef WITH_THREAD
1161  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1162  if (acquire_gil) {\
1163  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1164  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1165  PyGILState_Release(__pyx_gilstate_save);\
1166  } else {\
1167  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1168  }
1169 #else
1170  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1171  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1172 #endif
1173  #define __Pyx_RefNannyFinishContext()\
1174  __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1175  #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1176  #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1177  #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1178  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1179  #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1180  #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1181  #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1182  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1183 #else
1184  #define __Pyx_RefNannyDeclarations
1185  #define __Pyx_RefNannySetupContext(name, acquire_gil)
1186  #define __Pyx_RefNannyFinishContext()
1187  #define __Pyx_INCREF(r) Py_INCREF(r)
1188  #define __Pyx_DECREF(r) Py_DECREF(r)
1189  #define __Pyx_GOTREF(r)
1190  #define __Pyx_GIVEREF(r)
1191  #define __Pyx_XINCREF(r) Py_XINCREF(r)
1192  #define __Pyx_XDECREF(r) Py_XDECREF(r)
1193  #define __Pyx_XGOTREF(r)
1194  #define __Pyx_XGIVEREF(r)
1195 #endif
1196 #define __Pyx_XDECREF_SET(r, v) do {\
1197  PyObject *tmp = (PyObject *) r;\
1198  r = v; __Pyx_XDECREF(tmp);\
1199  } while (0)
1200 #define __Pyx_DECREF_SET(r, v) do {\
1201  PyObject *tmp = (PyObject *) r;\
1202  r = v; __Pyx_DECREF(tmp);\
1203  } while (0)
1204 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1205 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1206 
1207 /* PyObjectGetAttrStr.proto */
1208 #if CYTHON_USE_TYPE_SLOTS
1209 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1210 #else
1211 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1212 #endif
1213 
1214 /* GetBuiltinName.proto */
1215 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1216 
1217 /* RaiseArgTupleInvalid.proto */
1218 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1219  Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1220 
1221 /* RaiseDoubleKeywords.proto */
1222 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1223 
1224 /* ParseKeywords.proto */
1225 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1226  PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1227  const char* function_name);
1228 
1229 /* ArgTypeTest.proto */
1230 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1231  ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1232  __Pyx__ArgTypeTest(obj, type, name, exact))
1233 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1234 
1235 /* IsLittleEndian.proto */
1236 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
1237 
1238 /* BufferFormatCheck.proto */
1239 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
1240 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
1241  __Pyx_BufFmt_StackElem* stack,
1242  __Pyx_TypeInfo* type);
1243 
1244 /* BufferGetAndValidate.proto */
1245 #define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\
1246  ((obj == Py_None || obj == NULL) ?\
1247  (__Pyx_ZeroBuffer(buf), 0) :\
1248  __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack))
1249 static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
1250  __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
1251 static void __Pyx_ZeroBuffer(Py_buffer* buf);
1252 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
1253 static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
1254 static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
1255 
1256 /* BufferIndexError.proto */
1257 static void __Pyx_RaiseBufferIndexError(int axis);
1258 
1259 #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
1260 #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
1261 /* PyThreadStateGet.proto */
1262 #if CYTHON_FAST_THREAD_STATE
1263 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1264 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1265 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1266 #else
1267 #define __Pyx_PyThreadState_declare
1268 #define __Pyx_PyThreadState_assign
1269 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1270 #endif
1271 
1272 /* PyErrFetchRestore.proto */
1273 #if CYTHON_FAST_THREAD_STATE
1274 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1275 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1276 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1277 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1278 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1279 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1280 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1281 #if CYTHON_COMPILING_IN_CPYTHON
1282 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1283 #else
1284 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1285 #endif
1286 #else
1287 #define __Pyx_PyErr_Clear() PyErr_Clear()
1288 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1289 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1290 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1291 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1292 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1293 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1294 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1295 #endif
1296 
1297 /* DictGetItem.proto */
1298 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1299 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1300 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1301  (likely(PyDict_CheckExact(obj)) ?\
1302  __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1303 #else
1304 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1305 #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
1306 #endif
1307 
1308 #define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2)
1309 /* GetItemInt.proto */
1310 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1311  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1312  __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1313  (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1314  __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1315 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1316  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1317  __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1318  (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1319 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1320  int wraparound, int boundscheck);
1321 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1322  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1323  __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1324  (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1325 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1326  int wraparound, int boundscheck);
1327 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1328 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1329  int is_list, int wraparound, int boundscheck);
1330 
1331 /* ObjectGetItem.proto */
1332 #if CYTHON_USE_TYPE_SLOTS
1333 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1334 #else
1335 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1336 #endif
1337 
1338 /* PyFloatBinop.proto */
1339 #if !CYTHON_COMPILING_IN_PYPY
1340 static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
1341 #else
1342 #define __Pyx_PyFloat_AddObjC(op1, op2, floatval, inplace, zerodivision_check)\
1343  (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1344 #endif
1345 
1346 #define __Pyx_BufPtrStrided4d(type, buf, i0, s0, i1, s1, i2, s2, i3, s3) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2 + i3 * s3)
1347 /* PyFunctionFastCall.proto */
1348 #if CYTHON_FAST_PYCALL
1349 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1350  __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1351 #if 1 || PY_VERSION_HEX < 0x030600B1
1352 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1353 #else
1354 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1355 #endif
1356 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1357  (sizeof(char [1 - 2*!(cond)]) - 1)
1358 #ifndef Py_MEMBER_SIZE
1359 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1360 #endif
1361  static size_t __pyx_pyframe_localsplus_offset = 0;
1362  #include "frameobject.h"
1363  #define __Pxy_PyFrame_Initialize_Offsets()\
1364  ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1365  (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1366  #define __Pyx_PyFrame_GetLocalsplus(frame)\
1367  (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1368 #endif
1369 
1370 /* PyCFunctionFastCall.proto */
1371 #if CYTHON_FAST_PYCCALL
1372 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1373 #else
1374 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1375 #endif
1376 
1377 /* PyObjectCall.proto */
1378 #if CYTHON_COMPILING_IN_CPYTHON
1379 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1380 #else
1381 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1382 #endif
1383 
1384 /* PyDictVersioning.proto */
1385 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1386 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1387 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1388 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1389  (version_var) = __PYX_GET_DICT_VERSION(dict);\
1390  (cache_var) = (value);
1391 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1392  static PY_UINT64_T __pyx_dict_version = 0;\
1393  static PyObject *__pyx_dict_cached_value = NULL;\
1394  if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1395  (VAR) = __pyx_dict_cached_value;\
1396  } else {\
1397  (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1398  __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1399  }\
1400 }
1401 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1402 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1403 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1404 #else
1405 #define __PYX_GET_DICT_VERSION(dict) (0)
1406 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1407 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1408 #endif
1409 
1410 /* GetModuleGlobalName.proto */
1411 #if CYTHON_USE_DICT_VERSIONS
1412 #define __Pyx_GetModuleGlobalName(var, name) {\
1413  static PY_UINT64_T __pyx_dict_version = 0;\
1414  static PyObject *__pyx_dict_cached_value = NULL;\
1415  (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1416  (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1417  __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1418 }
1419 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1420  PY_UINT64_T __pyx_dict_version;\
1421  PyObject *__pyx_dict_cached_value;\
1422  (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1423 }
1424 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1425 #else
1426 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1427 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1428 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1429 #endif
1430 
1431 /* ExtTypeTest.proto */
1432 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1433 
1434 /* PyObjectCall2Args.proto */
1435 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1436 
1437 /* PyObjectCallMethO.proto */
1438 #if CYTHON_COMPILING_IN_CPYTHON
1439 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1440 #endif
1441 
1442 /* PyObjectCallOneArg.proto */
1443 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1444 
1445 /* pyobject_as_double.proto */
1446 static double __Pyx__PyObject_AsDouble(PyObject* obj);
1447 #if CYTHON_COMPILING_IN_PYPY
1448 #define __Pyx_PyObject_AsDouble(obj)\
1449 (likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) :\
1450  likely(PyInt_CheckExact(obj)) ?\
1451  PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
1452 #else
1453 #define __Pyx_PyObject_AsDouble(obj)\
1454 ((likely(PyFloat_CheckExact(obj))) ?\
1455  PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
1456 #endif
1457 
1458 /* RaiseException.proto */
1459 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1460 
1461 /* RaiseTooManyValuesToUnpack.proto */
1462 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1463 
1464 /* RaiseNeedMoreValuesToUnpack.proto */
1465 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1466 
1467 /* RaiseNoneIterError.proto */
1468 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1469 
1470 /* GetTopmostException.proto */
1471 #if CYTHON_USE_EXC_INFO_STACK
1472 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1473 #endif
1474 
1475 /* SaveResetException.proto */
1476 #if CYTHON_FAST_THREAD_STATE
1477 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1478 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1479 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1480 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1481 #else
1482 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1483 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1484 #endif
1485 
1486 /* PyErrExceptionMatches.proto */
1487 #if CYTHON_FAST_THREAD_STATE
1488 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1489 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1490 #else
1491 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1492 #endif
1493 
1494 /* GetException.proto */
1495 #if CYTHON_FAST_THREAD_STATE
1496 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1497 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1498 #else
1499 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1500 #endif
1501 
1502 /* TypeImport.proto */
1503 #ifndef __PYX_HAVE_RT_ImportType_proto
1504 #define __PYX_HAVE_RT_ImportType_proto
1505 enum __Pyx_ImportType_CheckSize {
1506  __Pyx_ImportType_CheckSize_Error = 0,
1507  __Pyx_ImportType_CheckSize_Warn = 1,
1508  __Pyx_ImportType_CheckSize_Ignore = 2
1509 };
1510 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1511 #endif
1512 
1513 /* Import.proto */
1514 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1515 
1516 /* CLineInTraceback.proto */
1517 #ifdef CYTHON_CLINE_IN_TRACEBACK
1518 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1519 #else
1520 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1521 #endif
1522 
1523 /* CodeObjectCache.proto */
1524 typedef struct {
1525  PyCodeObject* code_object;
1526  int code_line;
1527 } __Pyx_CodeObjectCacheEntry;
1528 struct __Pyx_CodeObjectCache {
1529  int count;
1530  int max_count;
1531  __Pyx_CodeObjectCacheEntry* entries;
1532 };
1533 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1534 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1535 static PyCodeObject *__pyx_find_code_object(int code_line);
1536 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1537 
1538 /* AddTraceback.proto */
1539 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1540  int py_line, const char *filename);
1541 
1542 /* BufferStructDeclare.proto */
1543 typedef struct {
1544  Py_ssize_t shape, strides, suboffsets;
1545 } __Pyx_Buf_DimInfo;
1546 typedef struct {
1547  size_t refcount;
1548  Py_buffer pybuffer;
1549 } __Pyx_Buffer;
1550 typedef struct {
1551  __Pyx_Buffer *rcbuffer;
1552  char *data;
1553  __Pyx_Buf_DimInfo diminfo[8];
1554 } __Pyx_LocalBuf_ND;
1555 
1556 #if PY_MAJOR_VERSION < 3
1557  static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
1558  static void __Pyx_ReleaseBuffer(Py_buffer *view);
1559 #else
1560  #define __Pyx_GetBuffer PyObject_GetBuffer
1561  #define __Pyx_ReleaseBuffer PyBuffer_Release
1562 #endif
1563 
1564 
1565 /* CIntToPy.proto */
1566 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1567 
1568 /* CIntToPy.proto */
1569 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value);
1570 
1571 /* CIntToPy.proto */
1572 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1573 
1574 /* RealImag.proto */
1575 #if CYTHON_CCOMPLEX
1576  #ifdef __cplusplus
1577  #define __Pyx_CREAL(z) ((z).real())
1578  #define __Pyx_CIMAG(z) ((z).imag())
1579  #else
1580  #define __Pyx_CREAL(z) (__real__(z))
1581  #define __Pyx_CIMAG(z) (__imag__(z))
1582  #endif
1583 #else
1584  #define __Pyx_CREAL(z) ((z).real)
1585  #define __Pyx_CIMAG(z) ((z).imag)
1586 #endif
1587 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
1588  && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
1589  #define __Pyx_SET_CREAL(z,x) ((z).real(x))
1590  #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
1591 #else
1592  #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
1593  #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
1594 #endif
1595 
1596 /* Arithmetic.proto */
1597 #if CYTHON_CCOMPLEX
1598  #define __Pyx_c_eq_float(a, b) ((a)==(b))
1599  #define __Pyx_c_sum_float(a, b) ((a)+(b))
1600  #define __Pyx_c_diff_float(a, b) ((a)-(b))
1601  #define __Pyx_c_prod_float(a, b) ((a)*(b))
1602  #define __Pyx_c_quot_float(a, b) ((a)/(b))
1603  #define __Pyx_c_neg_float(a) (-(a))
1604  #ifdef __cplusplus
1605  #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
1606  #define __Pyx_c_conj_float(z) (::std::conj(z))
1607  #if 1
1608  #define __Pyx_c_abs_float(z) (::std::abs(z))
1609  #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
1610  #endif
1611  #else
1612  #define __Pyx_c_is_zero_float(z) ((z)==0)
1613  #define __Pyx_c_conj_float(z) (conjf(z))
1614  #if 1
1615  #define __Pyx_c_abs_float(z) (cabsf(z))
1616  #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
1617  #endif
1618  #endif
1619 #else
1620  static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
1621  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
1622  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
1623  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
1624  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
1625  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
1626  static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
1627  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
1628  #if 1
1629  static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
1630  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
1631  #endif
1632 #endif
1633 
1634 /* Arithmetic.proto */
1635 #if CYTHON_CCOMPLEX
1636  #define __Pyx_c_eq_double(a, b) ((a)==(b))
1637  #define __Pyx_c_sum_double(a, b) ((a)+(b))
1638  #define __Pyx_c_diff_double(a, b) ((a)-(b))
1639  #define __Pyx_c_prod_double(a, b) ((a)*(b))
1640  #define __Pyx_c_quot_double(a, b) ((a)/(b))
1641  #define __Pyx_c_neg_double(a) (-(a))
1642  #ifdef __cplusplus
1643  #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
1644  #define __Pyx_c_conj_double(z) (::std::conj(z))
1645  #if 1
1646  #define __Pyx_c_abs_double(z) (::std::abs(z))
1647  #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
1648  #endif
1649  #else
1650  #define __Pyx_c_is_zero_double(z) ((z)==0)
1651  #define __Pyx_c_conj_double(z) (conj(z))
1652  #if 1
1653  #define __Pyx_c_abs_double(z) (cabs(z))
1654  #define __Pyx_c_pow_double(a, b) (cpow(a, b))
1655  #endif
1656  #endif
1657 #else
1658  static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
1659  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
1660  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
1661  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
1662  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
1663  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
1664  static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
1665  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
1666  #if 1
1667  static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
1668  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
1669  #endif
1670 #endif
1671 
1672 /* CIntToPy.proto */
1673 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
1674 
1675 /* CIntFromPy.proto */
1676 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1677 
1678 /* CIntFromPy.proto */
1679 static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *);
1680 
1681 /* CIntFromPy.proto */
1682 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1683 
1684 /* FastTypeChecks.proto */
1685 #if CYTHON_COMPILING_IN_CPYTHON
1686 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1687 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1688 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1689 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1690 #else
1691 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1692 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1693 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1694 #endif
1695 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1696 
1697 /* CheckBinaryVersion.proto */
1698 static int __Pyx_check_binary_version(void);
1699 
1700 /* InitStrings.proto */
1701 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1702 
1703 
1704 /* Module declarations from 'cpython.buffer' */
1705 
1706 /* Module declarations from 'libc.string' */
1707 
1708 /* Module declarations from 'libc.stdio' */
1709 
1710 /* Module declarations from '__builtin__' */
1711 
1712 /* Module declarations from 'cpython.type' */
1713 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1714 
1715 /* Module declarations from 'cpython' */
1716 
1717 /* Module declarations from 'cpython.object' */
1718 
1719 /* Module declarations from 'cpython.ref' */
1720 
1721 /* Module declarations from 'cpython.mem' */
1722 
1723 /* Module declarations from 'numpy' */
1724 
1725 /* Module declarations from 'numpy' */
1726 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
1727 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
1728 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
1729 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
1730 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
1731 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
1732 
1733 /* Module declarations from 'subsurfaceTransportFunctions' */
1734 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t = { "ITYPE_t", NULL, sizeof(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t), 0 };
1735 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t = { "DTYPE_t", NULL, sizeof(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t), { 0 }, 0, 'R', 0, 0 };
1736 #define __Pyx_MODULE_NAME "subsurfaceTransportFunctions"
1737 extern int __pyx_module_is_main_subsurfaceTransportFunctions;
1738 int __pyx_module_is_main_subsurfaceTransportFunctions = 0;
1739 
1740 /* Implementation of 'subsurfaceTransportFunctions' */
1741 static PyObject *__pyx_builtin_range;
1742 static PyObject *__pyx_builtin_ValueError;
1743 static PyObject *__pyx_builtin_RuntimeError;
1744 static PyObject *__pyx_builtin_ImportError;
1745 static const char __pyx_k_I[] = "I";
1746 static const char __pyx_k_J[] = "J";
1747 static const char __pyx_k_d[] = "d";
1748 static const char __pyx_k_i[] = "i";
1749 static const char __pyx_k_j[] = "j";
1750 static const char __pyx_k_k[] = "k";
1751 static const char __pyx_k_m[] = "m";
1752 static const char __pyx_k_n[] = "n";
1753 static const char __pyx_k_q[] = "q";
1754 static const char __pyx_k_t[] = "t";
1755 static const char __pyx_k_v[] = "v";
1756 static const char __pyx_k_w[] = "w";
1757 static const char __pyx_k_x[] = "x";
1758 static const char __pyx_k_dS[] = "dS";
1759 static const char __pyx_k_dV[] = "dV";
1760 static const char __pyx_k_df[] = "df";
1761 static const char __pyx_k_dm[] = "dm";
1762 static const char __pyx_k_eN[] = "eN";
1763 static const char __pyx_k_ii[] = "ii";
1764 static const char __pyx_k_kb[] = "kb";
1765 static const char __pyx_k_mt[] = "mt";
1766 static const char __pyx_k_nd[] = "nd";
1767 static const char __pyx_k_pi[] = "pi";
1768 static const char __pyx_k_xc[] = "xc";
1769 static const char __pyx_k_yc[] = "yc";
1770 static const char __pyx_k_KWr[] = "KWr";
1771 static const char __pyx_k_KWs[] = "KWs";
1772 static const char __pyx_k_dmt[] = "dmt";
1773 static const char __pyx_k_dot[] = "dot";
1774 static const char __pyx_k_ebN[] = "ebN";
1775 static const char __pyx_k_l2g[] = "l2g";
1776 static const char __pyx_k_nnz[] = "nnz";
1777 static const char __pyx_k_q_m[] = "q_m";
1778 static const char __pyx_k_q_r[] = "q_r";
1779 static const char __pyx_k_q_u[] = "q_u";
1780 static const char __pyx_k_q_x[] = "q_x";
1781 static const char __pyx_k_rho[] = "rho";
1782 static const char __pyx_k_sum[] = "sum";
1783 static const char __pyx_k_u_j[] = "u_j";
1784 static const char __pyx_k_vol[] = "vol";
1785 static const char __pyx_k_a_eN[] = "a_eN";
1786 static const char __pyx_k_a_up[] = "a_up";
1787 static const char __pyx_k_beta[] = "beta";
1788 static const char __pyx_k_ebNE[] = "ebNE";
1789 static const char __pyx_k_f_up[] = "f_up";
1790 static const char __pyx_k_flat[] = "flat";
1791 static const char __pyx_k_flux[] = "flux";
1792 static const char __pyx_k_main[] = "__main__";
1793 static const char __pyx_k_name[] = "__name__";
1794 static const char __pyx_k_one8[] = "one8";
1795 static const char __pyx_k_psiC[] = "psiC";
1796 static const char __pyx_k_q_dm[] = "q_dm";
1797 static const char __pyx_k_q_kr[] = "q_kr";
1798 static const char __pyx_k_q_mt[] = "q_mt";
1799 static const char __pyx_k_rho2[] = "rho2";
1800 static const char __pyx_k_rhom[] = "rhom";
1801 static const char __pyx_k_sBar[] = "sBar";
1802 static const char __pyx_k_test[] = "__test__";
1803 static const char __pyx_k_u_eN[] = "u_eN";
1804 static const char __pyx_k_vBar[] = "vBar";
1805 static const char __pyx_k_a_avg[] = "a_avg";
1806 static const char __pyx_k_alpha[] = "alpha";
1807 static const char __pyx_k_clock[] = "clock";
1808 static const char __pyx_k_denom[] = "denom";
1809 static const char __pyx_k_drhom[] = "drhom";
1810 static const char __pyx_k_kr_eN[] = "kr_eN";
1811 static const char __pyx_k_matID[] = "matID";
1812 static const char __pyx_k_numer[] = "numer";
1813 static const char __pyx_k_numpy[] = "numpy";
1814 static const char __pyx_k_pcBar[] = "pcBar";
1815 static const char __pyx_k_q_dkr[] = "q_dkr";
1816 static const char __pyx_k_q_dmt[] = "q_dmt";
1817 static const char __pyx_k_range[] = "range";
1818 static const char __pyx_k_shape[] = "shape";
1819 static const char __pyx_k_u_dof[] = "u_dof";
1820 static const char __pyx_k_u_l2g[] = "u_l2g";
1821 static const char __pyx_k_vBar2[] = "vBar2";
1822 static const char __pyx_k_vol_e[] = "vol_e";
1823 static const char __pyx_k_zeros[] = "zeros";
1824 static const char __pyx_k_a_neig[] = "a_neig";
1825 static const char __pyx_k_colind[] = "colind";
1826 static const char __pyx_k_dkr_up[] = "dkr_up";
1827 static const char __pyx_k_import[] = "__import__";
1828 static const char __pyx_k_mt_avg[] = "mt_avg";
1829 static const char __pyx_k_nSpace[] = "nSpace";
1830 static const char __pyx_k_phi_eN[] = "phi_eN";
1831 static const char __pyx_k_picard[] = "picard";
1832 static const char __pyx_k_q_alin[] = "q_alin";
1833 static const char __pyx_k_q_detJ[] = "q_detJ";
1834 static const char __pyx_k_q_flin[] = "q_flin";
1835 static const char __pyx_k_q_mass[] = "q_mass";
1836 static const char __pyx_k_q_vals[] = "q_vals";
1837 static const char __pyx_k_rowptr[] = "rowptr";
1838 static const char __pyx_k_thetaR[] = "thetaR";
1839 static const char __pyx_k_thetaS[] = "thetaS";
1840 static const char __pyx_k_thetaW[] = "thetaW";
1841 static const char __pyx_k_u_neig[] = "u_neig";
1842 static const char __pyx_k_volume[] = "volume";
1843 static const char __pyx_k_weight[] = "weight";
1844 static const char __pyx_k_df_dofs[] = "df_dofs";
1845 static const char __pyx_k_eN_left[] = "eN_left";
1846 static const char __pyx_k_gravity[] = "gravity";
1847 static const char __pyx_k_kr_neig[] = "kr_neig";
1848 static const char __pyx_k_nSpace2[] = "nSpace2";
1849 static const char __pyx_k_omega_e[] = "omega_e";
1850 static const char __pyx_k_pcBar_n[] = "pcBar_n";
1851 static const char __pyx_k_q_dmass[] = "q_dmass";
1852 static const char __pyx_k_q_kr_up[] = "q_kr_up";
1853 static const char __pyx_k_thetaSR[] = "thetaSR";
1854 static const char __pyx_k_dmtj_avg[] = "dmtj_avg";
1855 static const char __pyx_k_eN_right[] = "eN_right";
1856 static const char __pyx_k_ebq_vals[] = "ebq_vals";
1857 static const char __pyx_k_integral[] = "integral";
1858 static const char __pyx_k_material[] = "material";
1859 static const char __pyx_k_phi_neig[] = "phi_neig";
1860 static const char __pyx_k_q_grad_u[] = "q_grad_u";
1861 static const char __pyx_k_q_grad_v[] = "q_grad_v";
1862 static const char __pyx_k_q_grad_w[] = "q_grad_w";
1863 static const char __pyx_k_ebN_local[] = "ebN_local";
1864 static const char __pyx_k_pcBar_nM1[] = "pcBar_nM1";
1865 static const char __pyx_k_pcBar_nM2[] = "pcBar_nM2";
1866 static const char __pyx_k_sqrt_sBar[] = "sqrt_sBar";
1867 static const char __pyx_k_transient[] = "transient";
1868 static const char __pyx_k_volFactor[] = "volFactor";
1869 static const char __pyx_k_zVelocity[] = "zVelocity";
1870 static const char __pyx_k_zvelocity[] = "zvelocity";
1871 static const char __pyx_k_DKWr_DpsiC[] = "DKWr_DpsiC";
1872 static const char __pyx_k_ValueError[] = "ValueError";
1873 static const char __pyx_k_matID_neig[] = "matID_neig";
1874 static const char __pyx_k_nAvgWeight[] = "nAvgWeight";
1875 static const char __pyx_k_upwindFlag[] = "upwindFlag";
1876 static const char __pyx_k_DsBar_DpsiC[] = "DsBar_DpsiC";
1877 static const char __pyx_k_DvBar_DpsiC[] = "DvBar_DpsiC";
1878 static const char __pyx_k_ImportError[] = "ImportError";
1879 static const char __pyx_k_eN_neighbor[] = "eN_neighbor";
1880 static const char __pyx_k_RuntimeError[] = "RuntimeError";
1881 static const char __pyx_k_tForReversal[] = "tForReversal";
1882 static const char __pyx_k_DthetaW_DpsiC[] = "DthetaW_DpsiC";
1883 static const char __pyx_k_material_left[] = "material_left";
1884 static const char __pyx_k_weak_residual[] = "weak_residual";
1885 static const char __pyx_k_material_right[] = "material_right";
1886 static const char __pyx_k_ebq_global_vals[] = "ebq_global_vals";
1887 static const char __pyx_k_elementJacobian[] = "elementJacobian";
1888 static const char __pyx_k_elementResidual[] = "elementResidual";
1889 static const char __pyx_k_onePlus_pcBar_n[] = "onePlus_pcBar_n";
1890 static const char __pyx_k_nElements_global[] = "nElements_global";
1891 static const char __pyx_k_nDOF_test_element[] = "nDOF_test_element";
1892 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1893 static const char __pyx_k_material_functions[] = "material_functions";
1894 static const char __pyx_k_nDOF_trial_element[] = "nDOF_trial_element";
1895 static const char __pyx_k_updateMass_weakAvg[] = "updateMass_weakAvg";
1896 static const char __pyx_k_calculateNormalFlux[] = "calculateNormalFlux";
1897 static const char __pyx_k_thisElementIsUpwind[] = "thisElementIsUpwind";
1898 static const char __pyx_k_elementBoundaryTypes[] = "elementBoundaryTypes";
1899 static const char __pyx_k_elementMaterialTypes[] = "elementMaterialTypes";
1900 static const char __pyx_k_elementNeighborsArray[] = "elementNeighborsArray";
1901 static const char __pyx_k_elementBoundariesArray[] = "elementBoundariesArray";
1902 static const char __pyx_k_jacobian_weak_residual[] = "jacobian_weak_residual";
1903 static const char __pyx_k_characteristic_velocity[] = "characteristic_velocity";
1904 static const char __pyx_k_elementBarycentersArray[] = "elementBarycentersArray";
1905 static const char __pyx_k_nElementBoundaries_global[] = "nElementBoundaries_global";
1906 static const char __pyx_k_setElementBoundariesArray[] = "setElementBoundariesArray";
1907 static const char __pyx_k_RE_NCP1_getElementJacobian[] = "RE_NCP1_getElementJacobian";
1908 static const char __pyx_k_RE_NCP1_getElementResidual[] = "RE_NCP1_getElementResidual";
1909 static const char __pyx_k_nElementBoundaries_element[] = "nElementBoundaries_element";
1910 static const char __pyx_k_updateMassJacobian_weakAvg[] = "updateMassJacobian_weakAvg";
1911 static const char __pyx_k_vortexElementVelocityEval3[] = "vortexElementVelocityEval3";
1912 static const char __pyx_k_vortexElementVelocityEval4[] = "vortexElementVelocityEval4";
1913 static const char __pyx_k_helicalElementVelocityEval3[] = "helicalElementVelocityEval3";
1914 static const char __pyx_k_helicalElementVelocityEval4[] = "helicalElementVelocityEval4";
1915 static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
1916 static const char __pyx_k_characteristic_velocity_dofs[] = "characteristic_velocity_dofs";
1917 static const char __pyx_k_elementBoundaryElementsArray[] = "elementBoundaryElementsArray";
1918 static const char __pyx_k_elementBoundaryMaterialTypes[] = "elementBoundaryMaterialTypes";
1919 static const char __pyx_k_subsurfaceTransportFunctions[] = "subsurfaceTransportFunctions";
1920 static const char __pyx_k_exteriorElementBoundariesArray[] = "exteriorElementBoundariesArray";
1921 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
1922 static const char __pyx_k_setExteriorElementBoundaryTypes[] = "setExteriorElementBoundaryTypes";
1923 static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
1924 static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
1925 static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
1926 static const char __pyx_k_RE_NCP1_evaluateElementCoefficie[] = "RE_NCP1_evaluateElementCoefficients_Linear";
1927 static const char __pyx_k_computeSimpleCharacteristicVeloc[] = "computeSimpleCharacteristicVelocityFromElementVelocity";
1928 static const char __pyx_k_evaluateScalarMaterialFunctionOv[] = "evaluateScalarMaterialFunctionOverElements";
1929 static const char __pyx_k_evaluateSparseTensorMaterialFunc[] = "evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage";
1930 static const char __pyx_k_evaluateVectorMaterialFunctionOv[] = "evaluateVectorMaterialFunctionOverElements";
1931 static const char __pyx_k_exteriorElementBoundaryMaterialT[] = "exteriorElementBoundaryMaterialTypes";
1932 static const char __pyx_k_nExteriorElementBoundaries_globa[] = "nExteriorElementBoundaries_global";
1933 static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
1934 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
1935 static const char __pyx_k_proteus_subsurfaceTransportFunct[] = "proteus/subsurfaceTransportFunctions.pyx";
1936 static const char __pyx_k_rotatingGaussianElementVelocityE[] = "rotatingGaussianElementVelocityEval3";
1937 static const char __pyx_k_setScalarMaterialFunctionOverEle[] = "setScalarMaterialFunctionOverElements";
1938 static const char __pyx_k_setScalarMaterialFunctionOverGlo[] = "setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage";
1939 static const char __pyx_k_setSparseTensorMaterialFunctionO[] = "setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage";
1940 static const char __pyx_k_setVectorMaterialFunctionOverEle[] = "setVectorMaterialFunctionOverElements";
1941 static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
1942 static const char __pyx_k_RE_NCP1_evaluateElementCoefficie_2[] = "RE_NCP1_evaluateElementCoefficients_VGM";
1943 static const char __pyx_k_computeSimpleCharacteristicVeloc_2[] = "computeSimpleCharacteristicVelocityFromVelocityDOFs";
1944 static const char __pyx_k_evaluateScalarMaterialFunctionOv_2[] = "evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage";
1945 static const char __pyx_k_evaluateScalarMaterialFunctionOv_3[] = "evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage";
1946 static const char __pyx_k_evaluateSparseTensorMaterialFunc_2[] = "evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage";
1947 static const char __pyx_k_rotatingGaussianElementVelocityE_2[] = "rotatingGaussianElementVelocityEval4";
1948 static const char __pyx_k_setScalarMaterialFunctionOverEle_2[] = "setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage";
1949 static const char __pyx_k_setSparseTensorMaterialFunctionO_2[] = "setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage";
1950 static PyObject *__pyx_n_s_DKWr_DpsiC;
1951 static PyObject *__pyx_n_s_DsBar_DpsiC;
1952 static PyObject *__pyx_n_s_DthetaW_DpsiC;
1953 static PyObject *__pyx_n_s_DvBar_DpsiC;
1954 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
1955 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
1956 static PyObject *__pyx_n_s_I;
1957 static PyObject *__pyx_n_s_ImportError;
1958 static PyObject *__pyx_n_s_J;
1959 static PyObject *__pyx_n_s_KWr;
1960 static PyObject *__pyx_n_s_KWs;
1961 static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
1962 static PyObject *__pyx_n_s_RE_NCP1_evaluateElementCoefficie;
1963 static PyObject *__pyx_n_s_RE_NCP1_evaluateElementCoefficie_2;
1964 static PyObject *__pyx_n_s_RE_NCP1_getElementJacobian;
1965 static PyObject *__pyx_n_s_RE_NCP1_getElementResidual;
1966 static PyObject *__pyx_n_s_RuntimeError;
1967 static PyObject *__pyx_n_s_ValueError;
1968 static PyObject *__pyx_n_s_a_avg;
1969 static PyObject *__pyx_n_s_a_eN;
1970 static PyObject *__pyx_n_s_a_neig;
1971 static PyObject *__pyx_n_s_a_up;
1972 static PyObject *__pyx_n_s_alpha;
1973 static PyObject *__pyx_n_s_beta;
1974 static PyObject *__pyx_n_s_calculateNormalFlux;
1975 static PyObject *__pyx_n_s_characteristic_velocity;
1976 static PyObject *__pyx_n_s_characteristic_velocity_dofs;
1977 static PyObject *__pyx_n_s_cline_in_traceback;
1978 static PyObject *__pyx_n_s_clock;
1979 static PyObject *__pyx_n_s_colind;
1980 static PyObject *__pyx_n_s_computeSimpleCharacteristicVeloc;
1981 static PyObject *__pyx_n_s_computeSimpleCharacteristicVeloc_2;
1982 static PyObject *__pyx_n_s_d;
1983 static PyObject *__pyx_n_s_dS;
1984 static PyObject *__pyx_n_s_dV;
1985 static PyObject *__pyx_n_s_denom;
1986 static PyObject *__pyx_n_s_df;
1987 static PyObject *__pyx_n_s_df_dofs;
1988 static PyObject *__pyx_n_s_dkr_up;
1989 static PyObject *__pyx_n_s_dm;
1990 static PyObject *__pyx_n_s_dmt;
1991 static PyObject *__pyx_n_s_dmtj_avg;
1992 static PyObject *__pyx_n_s_dot;
1993 static PyObject *__pyx_n_s_drhom;
1994 static PyObject *__pyx_n_s_eN;
1995 static PyObject *__pyx_n_s_eN_left;
1996 static PyObject *__pyx_n_s_eN_neighbor;
1997 static PyObject *__pyx_n_s_eN_right;
1998 static PyObject *__pyx_n_s_ebN;
1999 static PyObject *__pyx_n_s_ebNE;
2000 static PyObject *__pyx_n_s_ebN_local;
2001 static PyObject *__pyx_n_s_ebq_global_vals;
2002 static PyObject *__pyx_n_s_ebq_vals;
2003 static PyObject *__pyx_n_s_elementBarycentersArray;
2004 static PyObject *__pyx_n_s_elementBoundariesArray;
2005 static PyObject *__pyx_n_s_elementBoundaryElementsArray;
2006 static PyObject *__pyx_n_s_elementBoundaryMaterialTypes;
2007 static PyObject *__pyx_n_s_elementBoundaryTypes;
2008 static PyObject *__pyx_n_s_elementJacobian;
2009 static PyObject *__pyx_n_s_elementMaterialTypes;
2010 static PyObject *__pyx_n_s_elementNeighborsArray;
2011 static PyObject *__pyx_n_s_elementResidual;
2012 static PyObject *__pyx_n_s_evaluateScalarMaterialFunctionOv;
2013 static PyObject *__pyx_n_s_evaluateScalarMaterialFunctionOv_2;
2014 static PyObject *__pyx_n_s_evaluateScalarMaterialFunctionOv_3;
2015 static PyObject *__pyx_n_s_evaluateSparseTensorMaterialFunc;
2016 static PyObject *__pyx_n_s_evaluateSparseTensorMaterialFunc_2;
2017 static PyObject *__pyx_n_s_evaluateVectorMaterialFunctionOv;
2018 static PyObject *__pyx_n_s_exteriorElementBoundariesArray;
2019 static PyObject *__pyx_n_s_exteriorElementBoundaryMaterialT;
2020 static PyObject *__pyx_n_s_f_up;
2021 static PyObject *__pyx_n_s_flat;
2022 static PyObject *__pyx_n_s_flux;
2023 static PyObject *__pyx_n_s_gravity;
2024 static PyObject *__pyx_n_s_helicalElementVelocityEval3;
2025 static PyObject *__pyx_n_s_helicalElementVelocityEval4;
2026 static PyObject *__pyx_n_s_i;
2027 static PyObject *__pyx_n_s_ii;
2028 static PyObject *__pyx_n_s_import;
2029 static PyObject *__pyx_n_s_integral;
2030 static PyObject *__pyx_n_s_j;
2031 static PyObject *__pyx_n_s_jacobian_weak_residual;
2032 static PyObject *__pyx_n_s_k;
2033 static PyObject *__pyx_n_s_kb;
2034 static PyObject *__pyx_n_s_kr_eN;
2035 static PyObject *__pyx_n_s_kr_neig;
2036 static PyObject *__pyx_n_s_l2g;
2037 static PyObject *__pyx_n_s_m;
2038 static PyObject *__pyx_n_s_main;
2039 static PyObject *__pyx_n_s_matID;
2040 static PyObject *__pyx_n_s_matID_neig;
2041 static PyObject *__pyx_n_s_material;
2042 static PyObject *__pyx_n_s_material_functions;
2043 static PyObject *__pyx_n_s_material_left;
2044 static PyObject *__pyx_n_s_material_right;
2045 static PyObject *__pyx_n_s_mt;
2046 static PyObject *__pyx_n_s_mt_avg;
2047 static PyObject *__pyx_n_s_n;
2048 static PyObject *__pyx_n_s_nAvgWeight;
2049 static PyObject *__pyx_n_s_nDOF_test_element;
2050 static PyObject *__pyx_n_s_nDOF_trial_element;
2051 static PyObject *__pyx_n_s_nElementBoundaries_element;
2052 static PyObject *__pyx_n_s_nElementBoundaries_global;
2053 static PyObject *__pyx_n_s_nElements_global;
2054 static PyObject *__pyx_n_s_nExteriorElementBoundaries_globa;
2055 static PyObject *__pyx_n_s_nSpace;
2056 static PyObject *__pyx_n_s_nSpace2;
2057 static PyObject *__pyx_n_s_name;
2058 static PyObject *__pyx_n_s_nd;
2059 static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
2060 static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
2061 static PyObject *__pyx_n_s_nnz;
2062 static PyObject *__pyx_n_s_numer;
2063 static PyObject *__pyx_n_s_numpy;
2064 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
2065 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
2066 static PyObject *__pyx_n_s_omega_e;
2067 static PyObject *__pyx_n_s_one8;
2068 static PyObject *__pyx_n_s_onePlus_pcBar_n;
2069 static PyObject *__pyx_n_s_pcBar;
2070 static PyObject *__pyx_n_s_pcBar_n;
2071 static PyObject *__pyx_n_s_pcBar_nM1;
2072 static PyObject *__pyx_n_s_pcBar_nM2;
2073 static PyObject *__pyx_n_s_phi_eN;
2074 static PyObject *__pyx_n_s_phi_neig;
2075 static PyObject *__pyx_n_s_pi;
2076 static PyObject *__pyx_n_s_picard;
2077 static PyObject *__pyx_kp_s_proteus_subsurfaceTransportFunct;
2078 static PyObject *__pyx_n_s_psiC;
2079 static PyObject *__pyx_n_s_q;
2080 static PyObject *__pyx_n_s_q_alin;
2081 static PyObject *__pyx_n_s_q_detJ;
2082 static PyObject *__pyx_n_s_q_dkr;
2083 static PyObject *__pyx_n_s_q_dm;
2084 static PyObject *__pyx_n_s_q_dmass;
2085 static PyObject *__pyx_n_s_q_dmt;
2086 static PyObject *__pyx_n_s_q_flin;
2087 static PyObject *__pyx_n_s_q_grad_u;
2088 static PyObject *__pyx_n_s_q_grad_v;
2089 static PyObject *__pyx_n_s_q_grad_w;
2090 static PyObject *__pyx_n_s_q_kr;
2091 static PyObject *__pyx_n_s_q_kr_up;
2092 static PyObject *__pyx_n_s_q_m;
2093 static PyObject *__pyx_n_s_q_mass;
2094 static PyObject *__pyx_n_s_q_mt;
2095 static PyObject *__pyx_n_s_q_r;
2096 static PyObject *__pyx_n_s_q_u;
2097 static PyObject *__pyx_n_s_q_vals;
2098 static PyObject *__pyx_n_s_q_x;
2099 static PyObject *__pyx_n_s_range;
2100 static PyObject *__pyx_n_s_rho;
2101 static PyObject *__pyx_n_s_rho2;
2102 static PyObject *__pyx_n_s_rhom;
2103 static PyObject *__pyx_n_s_rotatingGaussianElementVelocityE;
2104 static PyObject *__pyx_n_s_rotatingGaussianElementVelocityE_2;
2105 static PyObject *__pyx_n_s_rowptr;
2106 static PyObject *__pyx_n_s_sBar;
2107 static PyObject *__pyx_n_s_setElementBoundariesArray;
2108 static PyObject *__pyx_n_s_setExteriorElementBoundaryTypes;
2109 static PyObject *__pyx_n_s_setScalarMaterialFunctionOverEle;
2110 static PyObject *__pyx_n_s_setScalarMaterialFunctionOverEle_2;
2111 static PyObject *__pyx_n_s_setScalarMaterialFunctionOverGlo;
2112 static PyObject *__pyx_n_s_setSparseTensorMaterialFunctionO;
2113 static PyObject *__pyx_n_s_setSparseTensorMaterialFunctionO_2;
2114 static PyObject *__pyx_n_s_setVectorMaterialFunctionOverEle;
2115 static PyObject *__pyx_n_s_shape;
2116 static PyObject *__pyx_n_s_sqrt_sBar;
2117 static PyObject *__pyx_n_s_subsurfaceTransportFunctions;
2118 static PyObject *__pyx_n_s_sum;
2119 static PyObject *__pyx_n_s_t;
2120 static PyObject *__pyx_n_s_tForReversal;
2121 static PyObject *__pyx_n_s_test;
2122 static PyObject *__pyx_n_s_thetaR;
2123 static PyObject *__pyx_n_s_thetaS;
2124 static PyObject *__pyx_n_s_thetaSR;
2125 static PyObject *__pyx_n_s_thetaW;
2126 static PyObject *__pyx_n_s_thisElementIsUpwind;
2127 static PyObject *__pyx_n_s_transient;
2128 static PyObject *__pyx_n_s_u_dof;
2129 static PyObject *__pyx_n_s_u_eN;
2130 static PyObject *__pyx_n_s_u_j;
2131 static PyObject *__pyx_n_s_u_l2g;
2132 static PyObject *__pyx_n_s_u_neig;
2133 static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
2134 static PyObject *__pyx_n_s_updateMassJacobian_weakAvg;
2135 static PyObject *__pyx_n_s_updateMass_weakAvg;
2136 static PyObject *__pyx_n_s_upwindFlag;
2137 static PyObject *__pyx_n_s_v;
2138 static PyObject *__pyx_n_s_vBar;
2139 static PyObject *__pyx_n_s_vBar2;
2140 static PyObject *__pyx_n_s_vol;
2141 static PyObject *__pyx_n_s_volFactor;
2142 static PyObject *__pyx_n_s_vol_e;
2143 static PyObject *__pyx_n_s_volume;
2144 static PyObject *__pyx_n_s_vortexElementVelocityEval3;
2145 static PyObject *__pyx_n_s_vortexElementVelocityEval4;
2146 static PyObject *__pyx_n_s_w;
2147 static PyObject *__pyx_n_s_weak_residual;
2148 static PyObject *__pyx_n_s_weight;
2149 static PyObject *__pyx_n_s_x;
2150 static PyObject *__pyx_n_s_xc;
2151 static PyObject *__pyx_n_s_yc;
2152 static PyObject *__pyx_n_s_zVelocity;
2153 static PyObject *__pyx_n_s_zeros;
2154 static PyObject *__pyx_n_s_zvelocity;
2155 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_setExteriorElementBoundaryTypes(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nExteriorElementBoundaries_global, PyArrayObject *__pyx_v_exteriorElementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_exteriorElementBoundaryMaterialTypes); /* proto */
2156 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_2setElementBoundariesArray(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nElementBoundaries_global, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_elementBoundaryMaterialTypes); /* proto */
2157 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
2158 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
2159 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
2160 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
2161 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
2162 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
2163 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
2164 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
2165 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
2166 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
2167 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
2168 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
2169 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, PyArrayObject *__pyx_v_KWs, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin); /* proto */
2170 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, double __pyx_v_beta, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_alpha, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_thetaR, PyArrayObject *__pyx_v_thetaSR, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementBarycentersArray, PyArrayObject *__pyx_v_elementMaterialTypes, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_u_l2g, PyArrayObject *__pyx_v_u_dof, CYTHON_UNUSED PyArrayObject *__pyx_v_q_x, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_mass, PyArrayObject *__pyx_v_q_dmass, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up); /* proto */
2171 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementResidual); /* proto */
2172 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_q_u, CYTHON_UNUSED PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_grad_v, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dm, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_dmt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementJacobian); /* proto */
2173 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_36updateMass_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_weak_residual); /* proto */
2174 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_dmt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_jacobian_weak_residual); /* proto */
2175 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_40calculateNormalFlux(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_dS, PyArrayObject *__pyx_v_flux); /* proto */
2176 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df, PyArrayObject *__pyx_v_characteristic_velocity, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV); /* proto */
2177 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df_dofs, PyArrayObject *__pyx_v_characteristic_velocity_dofs, PyArrayObject *__pyx_v_l2g, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV); /* proto */
2178 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_46rotatingGaussianElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity); /* proto */
2179 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_48rotatingGaussianElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity); /* proto */
2180 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_50helicalElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
2181 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_52helicalElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
2182 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_54vortexElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
2183 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_56vortexElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
2184 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
2185 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
2186 static PyObject *__pyx_float_0_0;
2187 static PyObject *__pyx_float_0_5;
2188 static PyObject *__pyx_float_2_0;
2189 static PyObject *__pyx_float_1_0eneg_20;
2190 static PyObject *__pyx_slice_;
2191 static PyObject *__pyx_tuple__2;
2192 static PyObject *__pyx_tuple__3;
2193 static PyObject *__pyx_tuple__4;
2194 static PyObject *__pyx_tuple__5;
2195 static PyObject *__pyx_tuple__6;
2196 static PyObject *__pyx_tuple__7;
2197 static PyObject *__pyx_tuple__8;
2198 static PyObject *__pyx_tuple__9;
2199 static PyObject *__pyx_tuple__11;
2200 static PyObject *__pyx_tuple__13;
2201 static PyObject *__pyx_tuple__15;
2202 static PyObject *__pyx_tuple__17;
2203 static PyObject *__pyx_tuple__19;
2204 static PyObject *__pyx_tuple__21;
2205 static PyObject *__pyx_tuple__23;
2206 static PyObject *__pyx_tuple__25;
2207 static PyObject *__pyx_tuple__27;
2208 static PyObject *__pyx_tuple__29;
2209 static PyObject *__pyx_tuple__31;
2210 static PyObject *__pyx_tuple__33;
2211 static PyObject *__pyx_tuple__35;
2212 static PyObject *__pyx_tuple__37;
2213 static PyObject *__pyx_tuple__39;
2214 static PyObject *__pyx_tuple__41;
2215 static PyObject *__pyx_tuple__43;
2216 static PyObject *__pyx_tuple__45;
2217 static PyObject *__pyx_tuple__47;
2218 static PyObject *__pyx_tuple__49;
2219 static PyObject *__pyx_tuple__51;
2220 static PyObject *__pyx_tuple__53;
2221 static PyObject *__pyx_tuple__55;
2222 static PyObject *__pyx_tuple__57;
2223 static PyObject *__pyx_tuple__59;
2224 static PyObject *__pyx_tuple__61;
2225 static PyObject *__pyx_tuple__63;
2226 static PyObject *__pyx_tuple__65;
2227 static PyObject *__pyx_codeobj__10;
2228 static PyObject *__pyx_codeobj__12;
2229 static PyObject *__pyx_codeobj__14;
2230 static PyObject *__pyx_codeobj__16;
2231 static PyObject *__pyx_codeobj__18;
2232 static PyObject *__pyx_codeobj__20;
2233 static PyObject *__pyx_codeobj__22;
2234 static PyObject *__pyx_codeobj__24;
2235 static PyObject *__pyx_codeobj__26;
2236 static PyObject *__pyx_codeobj__28;
2237 static PyObject *__pyx_codeobj__30;
2238 static PyObject *__pyx_codeobj__32;
2239 static PyObject *__pyx_codeobj__34;
2240 static PyObject *__pyx_codeobj__36;
2241 static PyObject *__pyx_codeobj__38;
2242 static PyObject *__pyx_codeobj__40;
2243 static PyObject *__pyx_codeobj__42;
2244 static PyObject *__pyx_codeobj__44;
2245 static PyObject *__pyx_codeobj__46;
2246 static PyObject *__pyx_codeobj__48;
2247 static PyObject *__pyx_codeobj__50;
2248 static PyObject *__pyx_codeobj__52;
2249 static PyObject *__pyx_codeobj__54;
2250 static PyObject *__pyx_codeobj__56;
2251 static PyObject *__pyx_codeobj__58;
2252 static PyObject *__pyx_codeobj__60;
2253 static PyObject *__pyx_codeobj__62;
2254 static PyObject *__pyx_codeobj__64;
2255 static PyObject *__pyx_codeobj__66;
2256 /* Late includes */
2257 
2258 /* "subsurfaceTransportFunctions.pyx":11
2259  * double sin(double x)
2260  * double M_PI
2261  * cdef inline double double_max(double a, double b): return a if a >= b else b # <<<<<<<<<<<<<<
2262  * cdef inline double double_min(double a, double b): return a if a <= b else b
2263  *
2264  */
2265 
2266 static CYTHON_INLINE double __pyx_f_28subsurfaceTransportFunctions_double_max(double __pyx_v_a, double __pyx_v_b) {
2267  double __pyx_r;
2268  __Pyx_RefNannyDeclarations
2269  double __pyx_t_1;
2270  __Pyx_RefNannySetupContext("double_max", 0);
2271  if (((__pyx_v_a >= __pyx_v_b) != 0)) {
2272  __pyx_t_1 = __pyx_v_a;
2273  } else {
2274  __pyx_t_1 = __pyx_v_b;
2275  }
2276  __pyx_r = __pyx_t_1;
2277  goto __pyx_L0;
2278 
2279  /* function exit code */
2280  __pyx_L0:;
2281  __Pyx_RefNannyFinishContext();
2282  return __pyx_r;
2283 }
2284 
2285 /* "subsurfaceTransportFunctions.pyx":12
2286  * double M_PI
2287  * cdef inline double double_max(double a, double b): return a if a >= b else b
2288  * cdef inline double double_min(double a, double b): return a if a <= b else b # <<<<<<<<<<<<<<
2289  *
2290  * ctypedef numpy.double_t DTYPE_t
2291  */
2292 
2293 static CYTHON_INLINE double __pyx_f_28subsurfaceTransportFunctions_double_min(double __pyx_v_a, double __pyx_v_b) {
2294  double __pyx_r;
2295  __Pyx_RefNannyDeclarations
2296  double __pyx_t_1;
2297  __Pyx_RefNannySetupContext("double_min", 0);
2298  if (((__pyx_v_a <= __pyx_v_b) != 0)) {
2299  __pyx_t_1 = __pyx_v_a;
2300  } else {
2301  __pyx_t_1 = __pyx_v_b;
2302  }
2303  __pyx_r = __pyx_t_1;
2304  goto __pyx_L0;
2305 
2306  /* function exit code */
2307  __pyx_L0:;
2308  __Pyx_RefNannyFinishContext();
2309  return __pyx_r;
2310 }
2311 
2312 /* "subsurfaceTransportFunctions.pyx":18
2313  * ctypedef int ITYPE_t
2314  *
2315  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
2316  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
2317  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2318  */
2319 
2320 /* Python wrapper */
2321 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2322 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes = {"setExteriorElementBoundaryTypes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes, METH_VARARGS|METH_KEYWORDS, 0};
2323 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2324  int __pyx_v_nExteriorElementBoundaries_global;
2325  PyArrayObject *__pyx_v_exteriorElementBoundariesArray = 0;
2326  PyArrayObject *__pyx_v_elementBoundaryElementsArray = 0;
2327  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
2328  PyArrayObject *__pyx_v_exteriorElementBoundaryMaterialTypes = 0;
2329  PyObject *__pyx_r = 0;
2330  __Pyx_RefNannyDeclarations
2331  __Pyx_RefNannySetupContext("setExteriorElementBoundaryTypes (wrapper)", 0);
2332  {
2333  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nExteriorElementBoundaries_globa,&__pyx_n_s_exteriorElementBoundariesArray,&__pyx_n_s_elementBoundaryElementsArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_exteriorElementBoundaryMaterialT,0};
2334  PyObject* values[5] = {0,0,0,0,0};
2335  if (unlikely(__pyx_kwds)) {
2336  Py_ssize_t kw_args;
2337  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2338  switch (pos_args) {
2339  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2340  CYTHON_FALLTHROUGH;
2341  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2342  CYTHON_FALLTHROUGH;
2343  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2344  CYTHON_FALLTHROUGH;
2345  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2346  CYTHON_FALLTHROUGH;
2347  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2348  CYTHON_FALLTHROUGH;
2349  case 0: break;
2350  default: goto __pyx_L5_argtuple_error;
2351  }
2352  kw_args = PyDict_Size(__pyx_kwds);
2353  switch (pos_args) {
2354  case 0:
2355  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nExteriorElementBoundaries_globa)) != 0)) kw_args--;
2356  else goto __pyx_L5_argtuple_error;
2357  CYTHON_FALLTHROUGH;
2358  case 1:
2359  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exteriorElementBoundariesArray)) != 0)) kw_args--;
2360  else {
2361  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 1); __PYX_ERR(0, 18, __pyx_L3_error)
2362  }
2363  CYTHON_FALLTHROUGH;
2364  case 2:
2365  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryElementsArray)) != 0)) kw_args--;
2366  else {
2367  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 2); __PYX_ERR(0, 18, __pyx_L3_error)
2368  }
2369  CYTHON_FALLTHROUGH;
2370  case 3:
2371  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
2372  else {
2373  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 3); __PYX_ERR(0, 18, __pyx_L3_error)
2374  }
2375  CYTHON_FALLTHROUGH;
2376  case 4:
2377  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exteriorElementBoundaryMaterialT)) != 0)) kw_args--;
2378  else {
2379  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 4); __PYX_ERR(0, 18, __pyx_L3_error)
2380  }
2381  }
2382  if (unlikely(kw_args > 0)) {
2383  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setExteriorElementBoundaryTypes") < 0)) __PYX_ERR(0, 18, __pyx_L3_error)
2384  }
2385  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
2386  goto __pyx_L5_argtuple_error;
2387  } else {
2388  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2389  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2390  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2391  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2392  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2393  }
2394  __pyx_v_nExteriorElementBoundaries_global = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nExteriorElementBoundaries_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 18, __pyx_L3_error)
2395  __pyx_v_exteriorElementBoundariesArray = ((PyArrayObject *)values[1]);
2396  __pyx_v_elementBoundaryElementsArray = ((PyArrayObject *)values[2]);
2397  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[3]);
2398  __pyx_v_exteriorElementBoundaryMaterialTypes = ((PyArrayObject *)values[4]);
2399  }
2400  goto __pyx_L4_argument_unpacking_done;
2401  __pyx_L5_argtuple_error:;
2402  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 18, __pyx_L3_error)
2403  __pyx_L3_error:;
2404  __Pyx_AddTraceback("subsurfaceTransportFunctions.setExteriorElementBoundaryTypes", __pyx_clineno, __pyx_lineno, __pyx_filename);
2405  __Pyx_RefNannyFinishContext();
2406  return NULL;
2407  __pyx_L4_argument_unpacking_done:;
2408  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_exteriorElementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "exteriorElementBoundariesArray", 0))) __PYX_ERR(0, 19, __pyx_L1_error)
2409  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryElementsArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryElementsArray", 0))) __PYX_ERR(0, 20, __pyx_L1_error)
2410  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 21, __pyx_L1_error)
2411  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_exteriorElementBoundaryMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "exteriorElementBoundaryMaterialTypes", 0))) __PYX_ERR(0, 22, __pyx_L1_error)
2412  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_setExteriorElementBoundaryTypes(__pyx_self, __pyx_v_nExteriorElementBoundaries_global, __pyx_v_exteriorElementBoundariesArray, __pyx_v_elementBoundaryElementsArray, __pyx_v_elementMaterialTypes, __pyx_v_exteriorElementBoundaryMaterialTypes);
2413 
2414  /* function exit code */
2415  goto __pyx_L0;
2416  __pyx_L1_error:;
2417  __pyx_r = NULL;
2418  __pyx_L0:;
2419  __Pyx_RefNannyFinishContext();
2420  return __pyx_r;
2421 }
2422 
2423 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_setExteriorElementBoundaryTypes(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nExteriorElementBoundaries_global, PyArrayObject *__pyx_v_exteriorElementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_exteriorElementBoundaryMaterialTypes) {
2424  int __pyx_v_ebNE;
2425  int __pyx_v_ebN;
2426  int __pyx_v_eN;
2427  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryElementsArray;
2428  __Pyx_Buffer __pyx_pybuffer_elementBoundaryElementsArray;
2429  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
2430  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
2431  __Pyx_LocalBuf_ND __pyx_pybuffernd_exteriorElementBoundariesArray;
2432  __Pyx_Buffer __pyx_pybuffer_exteriorElementBoundariesArray;
2433  __Pyx_LocalBuf_ND __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes;
2434  __Pyx_Buffer __pyx_pybuffer_exteriorElementBoundaryMaterialTypes;
2435  PyObject *__pyx_r = NULL;
2436  __Pyx_RefNannyDeclarations
2437  int __pyx_t_1;
2438  int __pyx_t_2;
2439  int __pyx_t_3;
2440  Py_ssize_t __pyx_t_4;
2441  int __pyx_t_5;
2442  Py_ssize_t __pyx_t_6;
2443  Py_ssize_t __pyx_t_7;
2444  Py_ssize_t __pyx_t_8;
2445  Py_ssize_t __pyx_t_9;
2446  __Pyx_RefNannySetupContext("setExteriorElementBoundaryTypes", 0);
2447  __pyx_pybuffer_exteriorElementBoundariesArray.pybuffer.buf = NULL;
2448  __pyx_pybuffer_exteriorElementBoundariesArray.refcount = 0;
2449  __pyx_pybuffernd_exteriorElementBoundariesArray.data = NULL;
2450  __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer = &__pyx_pybuffer_exteriorElementBoundariesArray;
2451  __pyx_pybuffer_elementBoundaryElementsArray.pybuffer.buf = NULL;
2452  __pyx_pybuffer_elementBoundaryElementsArray.refcount = 0;
2453  __pyx_pybuffernd_elementBoundaryElementsArray.data = NULL;
2454  __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer = &__pyx_pybuffer_elementBoundaryElementsArray;
2455  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
2456  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
2457  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
2458  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
2459  __pyx_pybuffer_exteriorElementBoundaryMaterialTypes.pybuffer.buf = NULL;
2460  __pyx_pybuffer_exteriorElementBoundaryMaterialTypes.refcount = 0;
2461  __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.data = NULL;
2462  __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer = &__pyx_pybuffer_exteriorElementBoundaryMaterialTypes;
2463  {
2464  __Pyx_BufFmt_StackElem __pyx_stack[1];
2465  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_exteriorElementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error)
2466  }
2467  __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer.shape[0];
2468  {
2469  __Pyx_BufFmt_StackElem __pyx_stack[1];
2470  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryElementsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error)
2471  }
2472  __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[1];
2473  {
2474  __Pyx_BufFmt_StackElem __pyx_stack[1];
2475  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error)
2476  }
2477  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
2478  {
2479  __Pyx_BufFmt_StackElem __pyx_stack[1];
2480  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_exteriorElementBoundaryMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error)
2481  }
2482  __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer.shape[0];
2483 
2484  /* "subsurfaceTransportFunctions.pyx":24
2485  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundaryMaterialTypes):
2486  * cdef int ebNE,ebN,eN
2487  * for ebNE in range(nExteriorElementBoundaries_global): # <<<<<<<<<<<<<<
2488  * ebN = exteriorElementBoundariesArray[ebNE]
2489  * eN = elementBoundaryElementsArray[ebN,0]
2490  */
2491  __pyx_t_1 = __pyx_v_nExteriorElementBoundaries_global;
2492  __pyx_t_2 = __pyx_t_1;
2493  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
2494  __pyx_v_ebNE = __pyx_t_3;
2495 
2496  /* "subsurfaceTransportFunctions.pyx":25
2497  * cdef int ebNE,ebN,eN
2498  * for ebNE in range(nExteriorElementBoundaries_global):
2499  * ebN = exteriorElementBoundariesArray[ebNE] # <<<<<<<<<<<<<<
2500  * eN = elementBoundaryElementsArray[ebN,0]
2501  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
2502  */
2503  __pyx_t_4 = __pyx_v_ebNE;
2504  __pyx_t_5 = -1;
2505  if (__pyx_t_4 < 0) {
2506  __pyx_t_4 += __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].shape;
2507  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
2508  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].shape)) __pyx_t_5 = 0;
2509  if (unlikely(__pyx_t_5 != -1)) {
2510  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2511  __PYX_ERR(0, 25, __pyx_L1_error)
2512  }
2513  __pyx_v_ebN = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].strides));
2514 
2515  /* "subsurfaceTransportFunctions.pyx":26
2516  * for ebNE in range(nExteriorElementBoundaries_global):
2517  * ebN = exteriorElementBoundariesArray[ebNE]
2518  * eN = elementBoundaryElementsArray[ebN,0] # <<<<<<<<<<<<<<
2519  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
2520  *
2521  */
2522  __pyx_t_6 = __pyx_v_ebN;
2523  __pyx_t_7 = 0;
2524  __pyx_t_5 = -1;
2525  if (__pyx_t_6 < 0) {
2526  __pyx_t_6 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape;
2527  if (unlikely(__pyx_t_6 < 0)) __pyx_t_5 = 0;
2528  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape)) __pyx_t_5 = 0;
2529  if (__pyx_t_7 < 0) {
2530  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape;
2531  if (unlikely(__pyx_t_7 < 0)) __pyx_t_5 = 1;
2532  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape)) __pyx_t_5 = 1;
2533  if (unlikely(__pyx_t_5 != -1)) {
2534  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2535  __PYX_ERR(0, 26, __pyx_L1_error)
2536  }
2537  __pyx_v_eN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides));
2538 
2539  /* "subsurfaceTransportFunctions.pyx":27
2540  * ebN = exteriorElementBoundariesArray[ebNE]
2541  * eN = elementBoundaryElementsArray[ebN,0]
2542  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
2543  *
2544  * def setElementBoundariesArray(int nElementBoundaries_global,
2545  */
2546  __pyx_t_8 = __pyx_v_eN;
2547  __pyx_t_5 = -1;
2548  if (__pyx_t_8 < 0) {
2549  __pyx_t_8 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2550  if (unlikely(__pyx_t_8 < 0)) __pyx_t_5 = 0;
2551  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
2552  if (unlikely(__pyx_t_5 != -1)) {
2553  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2554  __PYX_ERR(0, 27, __pyx_L1_error)
2555  }
2556  __pyx_t_9 = __pyx_v_ebNE;
2557  __pyx_t_5 = -1;
2558  if (__pyx_t_9 < 0) {
2559  __pyx_t_9 += __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].shape;
2560  if (unlikely(__pyx_t_9 < 0)) __pyx_t_5 = 0;
2561  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
2562  if (unlikely(__pyx_t_5 != -1)) {
2563  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2564  __PYX_ERR(0, 27, __pyx_L1_error)
2565  }
2566  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2567  }
2568 
2569  /* "subsurfaceTransportFunctions.pyx":18
2570  * ctypedef int ITYPE_t
2571  *
2572  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
2573  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
2574  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2575  */
2576 
2577  /* function exit code */
2578  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2579  goto __pyx_L0;
2580  __pyx_L1_error:;
2581  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
2582  __Pyx_PyThreadState_declare
2583  __Pyx_PyThreadState_assign
2584  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
2585  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2586  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2587  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer);
2588  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer);
2589  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
2590  __Pyx_AddTraceback("subsurfaceTransportFunctions.setExteriorElementBoundaryTypes", __pyx_clineno, __pyx_lineno, __pyx_filename);
2591  __pyx_r = NULL;
2592  goto __pyx_L2;
2593  __pyx_L0:;
2594  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2595  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2596  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer);
2597  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer);
2598  __pyx_L2:;
2599  __Pyx_XGIVEREF(__pyx_r);
2600  __Pyx_RefNannyFinishContext();
2601  return __pyx_r;
2602 }
2603 
2604 /* "subsurfaceTransportFunctions.pyx":29
2605  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
2606  *
2607  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
2608  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2609  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
2610  */
2611 
2612 /* Python wrapper */
2613 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_3setElementBoundariesArray(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2614 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_3setElementBoundariesArray = {"setElementBoundariesArray", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_3setElementBoundariesArray, METH_VARARGS|METH_KEYWORDS, 0};
2615 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_3setElementBoundariesArray(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2616  int __pyx_v_nElementBoundaries_global;
2617  PyArrayObject *__pyx_v_elementBoundaryElementsArray = 0;
2618  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
2619  PyArrayObject *__pyx_v_elementBoundaryMaterialTypes = 0;
2620  PyObject *__pyx_r = 0;
2621  __Pyx_RefNannyDeclarations
2622  __Pyx_RefNannySetupContext("setElementBoundariesArray (wrapper)", 0);
2623  {
2624  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nElementBoundaries_global,&__pyx_n_s_elementBoundaryElementsArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_elementBoundaryMaterialTypes,0};
2625  PyObject* values[4] = {0,0,0,0};
2626  if (unlikely(__pyx_kwds)) {
2627  Py_ssize_t kw_args;
2628  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2629  switch (pos_args) {
2630  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2631  CYTHON_FALLTHROUGH;
2632  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2633  CYTHON_FALLTHROUGH;
2634  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2635  CYTHON_FALLTHROUGH;
2636  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2637  CYTHON_FALLTHROUGH;
2638  case 0: break;
2639  default: goto __pyx_L5_argtuple_error;
2640  }
2641  kw_args = PyDict_Size(__pyx_kwds);
2642  switch (pos_args) {
2643  case 0:
2644  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_global)) != 0)) kw_args--;
2645  else goto __pyx_L5_argtuple_error;
2646  CYTHON_FALLTHROUGH;
2647  case 1:
2648  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryElementsArray)) != 0)) kw_args--;
2649  else {
2650  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, 1); __PYX_ERR(0, 29, __pyx_L3_error)
2651  }
2652  CYTHON_FALLTHROUGH;
2653  case 2:
2654  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
2655  else {
2656  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, 2); __PYX_ERR(0, 29, __pyx_L3_error)
2657  }
2658  CYTHON_FALLTHROUGH;
2659  case 3:
2660  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryMaterialTypes)) != 0)) kw_args--;
2661  else {
2662  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, 3); __PYX_ERR(0, 29, __pyx_L3_error)
2663  }
2664  }
2665  if (unlikely(kw_args > 0)) {
2666  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setElementBoundariesArray") < 0)) __PYX_ERR(0, 29, __pyx_L3_error)
2667  }
2668  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
2669  goto __pyx_L5_argtuple_error;
2670  } else {
2671  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2672  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2673  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2674  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2675  }
2676  __pyx_v_nElementBoundaries_global = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nElementBoundaries_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 29, __pyx_L3_error)
2677  __pyx_v_elementBoundaryElementsArray = ((PyArrayObject *)values[1]);
2678  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[2]);
2679  __pyx_v_elementBoundaryMaterialTypes = ((PyArrayObject *)values[3]);
2680  }
2681  goto __pyx_L4_argument_unpacking_done;
2682  __pyx_L5_argtuple_error:;
2683  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 29, __pyx_L3_error)
2684  __pyx_L3_error:;
2685  __Pyx_AddTraceback("subsurfaceTransportFunctions.setElementBoundariesArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
2686  __Pyx_RefNannyFinishContext();
2687  return NULL;
2688  __pyx_L4_argument_unpacking_done:;
2689  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryElementsArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryElementsArray", 0))) __PYX_ERR(0, 30, __pyx_L1_error)
2690  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 31, __pyx_L1_error)
2691  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryMaterialTypes", 0))) __PYX_ERR(0, 32, __pyx_L1_error)
2692  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_2setElementBoundariesArray(__pyx_self, __pyx_v_nElementBoundaries_global, __pyx_v_elementBoundaryElementsArray, __pyx_v_elementMaterialTypes, __pyx_v_elementBoundaryMaterialTypes);
2693 
2694  /* function exit code */
2695  goto __pyx_L0;
2696  __pyx_L1_error:;
2697  __pyx_r = NULL;
2698  __pyx_L0:;
2699  __Pyx_RefNannyFinishContext();
2700  return __pyx_r;
2701 }
2702 
2703 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_2setElementBoundariesArray(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nElementBoundaries_global, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_elementBoundaryMaterialTypes) {
2704  int __pyx_v_ebN;
2705  int __pyx_v_eN_left;
2706  int __pyx_v_eN_right;
2707  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryElementsArray;
2708  __Pyx_Buffer __pyx_pybuffer_elementBoundaryElementsArray;
2709  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryMaterialTypes;
2710  __Pyx_Buffer __pyx_pybuffer_elementBoundaryMaterialTypes;
2711  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
2712  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
2713  PyObject *__pyx_r = NULL;
2714  __Pyx_RefNannyDeclarations
2715  int __pyx_t_1;
2716  int __pyx_t_2;
2717  int __pyx_t_3;
2718  Py_ssize_t __pyx_t_4;
2719  Py_ssize_t __pyx_t_5;
2720  int __pyx_t_6;
2721  Py_ssize_t __pyx_t_7;
2722  Py_ssize_t __pyx_t_8;
2723  Py_ssize_t __pyx_t_9;
2724  Py_ssize_t __pyx_t_10;
2725  Py_ssize_t __pyx_t_11;
2726  Py_ssize_t __pyx_t_12;
2727  Py_ssize_t __pyx_t_13;
2728  Py_ssize_t __pyx_t_14;
2729  int __pyx_t_15;
2730  Py_ssize_t __pyx_t_16;
2731  Py_ssize_t __pyx_t_17;
2732  Py_ssize_t __pyx_t_18;
2733  __Pyx_RefNannySetupContext("setElementBoundariesArray", 0);
2734  __pyx_pybuffer_elementBoundaryElementsArray.pybuffer.buf = NULL;
2735  __pyx_pybuffer_elementBoundaryElementsArray.refcount = 0;
2736  __pyx_pybuffernd_elementBoundaryElementsArray.data = NULL;
2737  __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer = &__pyx_pybuffer_elementBoundaryElementsArray;
2738  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
2739  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
2740  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
2741  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
2742  __pyx_pybuffer_elementBoundaryMaterialTypes.pybuffer.buf = NULL;
2743  __pyx_pybuffer_elementBoundaryMaterialTypes.refcount = 0;
2744  __pyx_pybuffernd_elementBoundaryMaterialTypes.data = NULL;
2745  __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryMaterialTypes;
2746  {
2747  __Pyx_BufFmt_StackElem __pyx_stack[1];
2748  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryElementsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error)
2749  }
2750  __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[1];
2751  {
2752  __Pyx_BufFmt_StackElem __pyx_stack[1];
2753  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error)
2754  }
2755  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
2756  {
2757  __Pyx_BufFmt_StackElem __pyx_stack[1];
2758  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error)
2759  }
2760  __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.shape[1];
2761 
2762  /* "subsurfaceTransportFunctions.pyx":34
2763  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryMaterialTypes):
2764  * cdef int ebN,eN_left,eN_right
2765  * for ebN in range(nElementBoundaries_global): # <<<<<<<<<<<<<<
2766  * eN_left = elementBoundaryElementsArray[ebN,0]
2767  * eN_right= elementBoundaryElementsArray[ebN,1]
2768  */
2769  __pyx_t_1 = __pyx_v_nElementBoundaries_global;
2770  __pyx_t_2 = __pyx_t_1;
2771  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
2772  __pyx_v_ebN = __pyx_t_3;
2773 
2774  /* "subsurfaceTransportFunctions.pyx":35
2775  * cdef int ebN,eN_left,eN_right
2776  * for ebN in range(nElementBoundaries_global):
2777  * eN_left = elementBoundaryElementsArray[ebN,0] # <<<<<<<<<<<<<<
2778  * eN_right= elementBoundaryElementsArray[ebN,1]
2779  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2780  */
2781  __pyx_t_4 = __pyx_v_ebN;
2782  __pyx_t_5 = 0;
2783  __pyx_t_6 = -1;
2784  if (__pyx_t_4 < 0) {
2785  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape;
2786  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
2787  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape)) __pyx_t_6 = 0;
2788  if (__pyx_t_5 < 0) {
2789  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape;
2790  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
2791  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape)) __pyx_t_6 = 1;
2792  if (unlikely(__pyx_t_6 != -1)) {
2793  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2794  __PYX_ERR(0, 35, __pyx_L1_error)
2795  }
2796  __pyx_v_eN_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides));
2797 
2798  /* "subsurfaceTransportFunctions.pyx":36
2799  * for ebN in range(nElementBoundaries_global):
2800  * eN_left = elementBoundaryElementsArray[ebN,0]
2801  * eN_right= elementBoundaryElementsArray[ebN,1] # <<<<<<<<<<<<<<
2802  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2803  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2804  */
2805  __pyx_t_7 = __pyx_v_ebN;
2806  __pyx_t_8 = 1;
2807  __pyx_t_6 = -1;
2808  if (__pyx_t_7 < 0) {
2809  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape;
2810  if (unlikely(__pyx_t_7 < 0)) __pyx_t_6 = 0;
2811  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape)) __pyx_t_6 = 0;
2812  if (__pyx_t_8 < 0) {
2813  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape;
2814  if (unlikely(__pyx_t_8 < 0)) __pyx_t_6 = 1;
2815  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape)) __pyx_t_6 = 1;
2816  if (unlikely(__pyx_t_6 != -1)) {
2817  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2818  __PYX_ERR(0, 36, __pyx_L1_error)
2819  }
2820  __pyx_v_eN_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides));
2821 
2822  /* "subsurfaceTransportFunctions.pyx":37
2823  * eN_left = elementBoundaryElementsArray[ebN,0]
2824  * eN_right= elementBoundaryElementsArray[ebN,1]
2825  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left] # <<<<<<<<<<<<<<
2826  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2827  * if eN_right >= 0:
2828  */
2829  __pyx_t_9 = __pyx_v_eN_left;
2830  __pyx_t_6 = -1;
2831  if (__pyx_t_9 < 0) {
2832  __pyx_t_9 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2833  if (unlikely(__pyx_t_9 < 0)) __pyx_t_6 = 0;
2834  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2835  if (unlikely(__pyx_t_6 != -1)) {
2836  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2837  __PYX_ERR(0, 37, __pyx_L1_error)
2838  }
2839  __pyx_t_10 = __pyx_v_ebN;
2840  __pyx_t_11 = 0;
2841  __pyx_t_6 = -1;
2842  if (__pyx_t_10 < 0) {
2843  __pyx_t_10 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape;
2844  if (unlikely(__pyx_t_10 < 0)) __pyx_t_6 = 0;
2845  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2846  if (__pyx_t_11 < 0) {
2847  __pyx_t_11 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape;
2848  if (unlikely(__pyx_t_11 < 0)) __pyx_t_6 = 1;
2849  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape)) __pyx_t_6 = 1;
2850  if (unlikely(__pyx_t_6 != -1)) {
2851  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2852  __PYX_ERR(0, 37, __pyx_L1_error)
2853  }
2854  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2855 
2856  /* "subsurfaceTransportFunctions.pyx":38
2857  * eN_right= elementBoundaryElementsArray[ebN,1]
2858  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2859  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left] # <<<<<<<<<<<<<<
2860  * if eN_right >= 0:
2861  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right]
2862  */
2863  __pyx_t_12 = __pyx_v_eN_left;
2864  __pyx_t_6 = -1;
2865  if (__pyx_t_12 < 0) {
2866  __pyx_t_12 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2867  if (unlikely(__pyx_t_12 < 0)) __pyx_t_6 = 0;
2868  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2869  if (unlikely(__pyx_t_6 != -1)) {
2870  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2871  __PYX_ERR(0, 38, __pyx_L1_error)
2872  }
2873  __pyx_t_13 = __pyx_v_ebN;
2874  __pyx_t_14 = 1;
2875  __pyx_t_6 = -1;
2876  if (__pyx_t_13 < 0) {
2877  __pyx_t_13 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape;
2878  if (unlikely(__pyx_t_13 < 0)) __pyx_t_6 = 0;
2879  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2880  if (__pyx_t_14 < 0) {
2881  __pyx_t_14 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape;
2882  if (unlikely(__pyx_t_14 < 0)) __pyx_t_6 = 1;
2883  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape)) __pyx_t_6 = 1;
2884  if (unlikely(__pyx_t_6 != -1)) {
2885  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2886  __PYX_ERR(0, 38, __pyx_L1_error)
2887  }
2888  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2889 
2890  /* "subsurfaceTransportFunctions.pyx":39
2891  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2892  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2893  * if eN_right >= 0: # <<<<<<<<<<<<<<
2894  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right]
2895  *
2896  */
2897  __pyx_t_15 = ((__pyx_v_eN_right >= 0) != 0);
2898  if (__pyx_t_15) {
2899 
2900  /* "subsurfaceTransportFunctions.pyx":40
2901  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2902  * if eN_right >= 0:
2903  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right] # <<<<<<<<<<<<<<
2904  *
2905  * ###
2906  */
2907  __pyx_t_16 = __pyx_v_eN_right;
2908  __pyx_t_6 = -1;
2909  if (__pyx_t_16 < 0) {
2910  __pyx_t_16 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2911  if (unlikely(__pyx_t_16 < 0)) __pyx_t_6 = 0;
2912  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2913  if (unlikely(__pyx_t_6 != -1)) {
2914  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2915  __PYX_ERR(0, 40, __pyx_L1_error)
2916  }
2917  __pyx_t_17 = __pyx_v_ebN;
2918  __pyx_t_18 = 1;
2919  __pyx_t_6 = -1;
2920  if (__pyx_t_17 < 0) {
2921  __pyx_t_17 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape;
2922  if (unlikely(__pyx_t_17 < 0)) __pyx_t_6 = 0;
2923  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2924  if (__pyx_t_18 < 0) {
2925  __pyx_t_18 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape;
2926  if (unlikely(__pyx_t_18 < 0)) __pyx_t_6 = 1;
2927  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape)) __pyx_t_6 = 1;
2928  if (unlikely(__pyx_t_6 != -1)) {
2929  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2930  __PYX_ERR(0, 40, __pyx_L1_error)
2931  }
2932  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2933 
2934  /* "subsurfaceTransportFunctions.pyx":39
2935  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2936  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2937  * if eN_right >= 0: # <<<<<<<<<<<<<<
2938  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right]
2939  *
2940  */
2941  }
2942  }
2943 
2944  /* "subsurfaceTransportFunctions.pyx":29
2945  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
2946  *
2947  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
2948  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2949  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
2950  */
2951 
2952  /* function exit code */
2953  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2954  goto __pyx_L0;
2955  __pyx_L1_error:;
2956  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
2957  __Pyx_PyThreadState_declare
2958  __Pyx_PyThreadState_assign
2959  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
2960  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2961  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer);
2962  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2963  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
2964  __Pyx_AddTraceback("subsurfaceTransportFunctions.setElementBoundariesArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
2965  __pyx_r = NULL;
2966  goto __pyx_L2;
2967  __pyx_L0:;
2968  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2969  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer);
2970  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2971  __pyx_L2:;
2972  __Pyx_XGIVEREF(__pyx_r);
2973  __Pyx_RefNannyFinishContext();
2974  return __pyx_r;
2975 }
2976 
2977 /* "subsurfaceTransportFunctions.pyx":43
2978  *
2979  * ###
2980  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
2981  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
2982  * dict material_functions):
2983  */
2984 
2985 /* Python wrapper */
2986 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2987 static char __pyx_doc_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements[] = "\n loop over quadrature array and set is material j\n likely little improvement right now without correct typing of material_functions\n ";
2988 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements = {"setScalarMaterialFunctionOverElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements};
2989 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2990  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
2991  PyArrayObject *__pyx_v_q_vals = 0;
2992  PyObject *__pyx_v_material_functions = 0;
2993  PyObject *__pyx_r = 0;
2994  __Pyx_RefNannyDeclarations
2995  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElements (wrapper)", 0);
2996  {
2997  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
2998  PyObject* values[3] = {0,0,0};
2999  if (unlikely(__pyx_kwds)) {
3000  Py_ssize_t kw_args;
3001  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3002  switch (pos_args) {
3003  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3004  CYTHON_FALLTHROUGH;
3005  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3006  CYTHON_FALLTHROUGH;
3007  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3008  CYTHON_FALLTHROUGH;
3009  case 0: break;
3010  default: goto __pyx_L5_argtuple_error;
3011  }
3012  kw_args = PyDict_Size(__pyx_kwds);
3013  switch (pos_args) {
3014  case 0:
3015  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
3016  else goto __pyx_L5_argtuple_error;
3017  CYTHON_FALLTHROUGH;
3018  case 1:
3019  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
3020  else {
3021  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElements", 1, 3, 3, 1); __PYX_ERR(0, 43, __pyx_L3_error)
3022  }
3023  CYTHON_FALLTHROUGH;
3024  case 2:
3025  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
3026  else {
3027  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElements", 1, 3, 3, 2); __PYX_ERR(0, 43, __pyx_L3_error)
3028  }
3029  }
3030  if (unlikely(kw_args > 0)) {
3031  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setScalarMaterialFunctionOverElements") < 0)) __PYX_ERR(0, 43, __pyx_L3_error)
3032  }
3033  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
3034  goto __pyx_L5_argtuple_error;
3035  } else {
3036  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3037  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3038  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3039  }
3040  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[0]);
3041  __pyx_v_q_vals = ((PyArrayObject *)values[1]);
3042  __pyx_v_material_functions = ((PyObject*)values[2]);
3043  }
3044  goto __pyx_L4_argument_unpacking_done;
3045  __pyx_L5_argtuple_error:;
3046  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElements", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 43, __pyx_L3_error)
3047  __pyx_L3_error:;
3048  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
3049  __Pyx_RefNannyFinishContext();
3050  return NULL;
3051  __pyx_L4_argument_unpacking_done:;
3052  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 43, __pyx_L1_error)
3053  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) __PYX_ERR(0, 44, __pyx_L1_error)
3054  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 45, __pyx_L1_error)
3055  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements(__pyx_self, __pyx_v_elementMaterialTypes, __pyx_v_q_vals, __pyx_v_material_functions);
3056 
3057  /* function exit code */
3058  goto __pyx_L0;
3059  __pyx_L1_error:;
3060  __pyx_r = NULL;
3061  __pyx_L0:;
3062  __Pyx_RefNannyFinishContext();
3063  return __pyx_r;
3064 }
3065 
3066 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
3067  int __pyx_v_eN;
3068  int __pyx_v_k;
3069  int __pyx_v_material;
3070  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
3071  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
3072  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
3073  __Pyx_Buffer __pyx_pybuffer_q_vals;
3074  PyObject *__pyx_r = NULL;
3075  __Pyx_RefNannyDeclarations
3076  npy_intp __pyx_t_1;
3077  npy_intp __pyx_t_2;
3078  int __pyx_t_3;
3079  Py_ssize_t __pyx_t_4;
3080  int __pyx_t_5;
3081  npy_intp __pyx_t_6;
3082  npy_intp __pyx_t_7;
3083  PyObject *__pyx_t_8 = NULL;
3084  PyObject *__pyx_t_9 = NULL;
3085  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_10;
3086  Py_ssize_t __pyx_t_11;
3087  Py_ssize_t __pyx_t_12;
3088  int __pyx_t_13;
3089  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElements", 0);
3090  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
3091  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
3092  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
3093  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
3094  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
3095  __pyx_pybuffer_q_vals.refcount = 0;
3096  __pyx_pybuffernd_q_vals.data = NULL;
3097  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
3098  {
3099  __Pyx_BufFmt_StackElem __pyx_stack[1];
3100  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 43, __pyx_L1_error)
3101  }
3102  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
3103  {
3104  __Pyx_BufFmt_StackElem __pyx_stack[1];
3105  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 43, __pyx_L1_error)
3106  }
3107  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1];
3108 
3109  /* "subsurfaceTransportFunctions.pyx":51
3110  * """
3111  * cdef int eN,k,material
3112  * for eN in range(q_vals.shape[0]): # <<<<<<<<<<<<<<
3113  * material = elementMaterialTypes[eN]
3114  * for k in range(q_vals.shape[1]):
3115  */
3116  __pyx_t_1 = (__pyx_v_q_vals->dimensions[0]);
3117  __pyx_t_2 = __pyx_t_1;
3118  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3119  __pyx_v_eN = __pyx_t_3;
3120 
3121  /* "subsurfaceTransportFunctions.pyx":52
3122  * cdef int eN,k,material
3123  * for eN in range(q_vals.shape[0]):
3124  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
3125  * for k in range(q_vals.shape[1]):
3126  * q_vals[eN,k] = material_functions[material]
3127  */
3128  __pyx_t_4 = __pyx_v_eN;
3129  __pyx_t_5 = -1;
3130  if (__pyx_t_4 < 0) {
3131  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
3132  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
3133  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
3134  if (unlikely(__pyx_t_5 != -1)) {
3135  __Pyx_RaiseBufferIndexError(__pyx_t_5);
3136  __PYX_ERR(0, 52, __pyx_L1_error)
3137  }
3138  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
3139 
3140  /* "subsurfaceTransportFunctions.pyx":53
3141  * for eN in range(q_vals.shape[0]):
3142  * material = elementMaterialTypes[eN]
3143  * for k in range(q_vals.shape[1]): # <<<<<<<<<<<<<<
3144  * q_vals[eN,k] = material_functions[material]
3145  *
3146  */
3147  __pyx_t_6 = (__pyx_v_q_vals->dimensions[1]);
3148  __pyx_t_7 = __pyx_t_6;
3149  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_7; __pyx_t_5+=1) {
3150  __pyx_v_k = __pyx_t_5;
3151 
3152  /* "subsurfaceTransportFunctions.pyx":54
3153  * material = elementMaterialTypes[eN]
3154  * for k in range(q_vals.shape[1]):
3155  * q_vals[eN,k] = material_functions[material] # <<<<<<<<<<<<<<
3156  *
3157  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
3158  */
3159  if (unlikely(__pyx_v_material_functions == Py_None)) {
3160  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3161  __PYX_ERR(0, 54, __pyx_L1_error)
3162  }
3163  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 54, __pyx_L1_error)
3164  __Pyx_GOTREF(__pyx_t_8);
3165  __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 54, __pyx_L1_error)
3166  __Pyx_GOTREF(__pyx_t_9);
3167  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3168  __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_10 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L1_error)
3169  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3170  __pyx_t_11 = __pyx_v_eN;
3171  __pyx_t_12 = __pyx_v_k;
3172  __pyx_t_13 = -1;
3173  if (__pyx_t_11 < 0) {
3174  __pyx_t_11 += __pyx_pybuffernd_q_vals.diminfo[0].shape;
3175  if (unlikely(__pyx_t_11 < 0)) __pyx_t_13 = 0;
3176  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_vals.diminfo[0].shape)) __pyx_t_13 = 0;
3177  if (__pyx_t_12 < 0) {
3178  __pyx_t_12 += __pyx_pybuffernd_q_vals.diminfo[1].shape;
3179  if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 1;
3180  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_q_vals.diminfo[1].shape)) __pyx_t_13 = 1;
3181  if (unlikely(__pyx_t_13 != -1)) {
3182  __Pyx_RaiseBufferIndexError(__pyx_t_13);
3183  __PYX_ERR(0, 54, __pyx_L1_error)
3184  }
3185  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_q_vals.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_q_vals.diminfo[1].strides) = __pyx_t_10;
3186  }
3187  }
3188 
3189  /* "subsurfaceTransportFunctions.pyx":43
3190  *
3191  * ###
3192  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
3193  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
3194  * dict material_functions):
3195  */
3196 
3197  /* function exit code */
3198  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3199  goto __pyx_L0;
3200  __pyx_L1_error:;
3201  __Pyx_XDECREF(__pyx_t_8);
3202  __Pyx_XDECREF(__pyx_t_9);
3203  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3204  __Pyx_PyThreadState_declare
3205  __Pyx_PyThreadState_assign
3206  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3207  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
3208  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
3209  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3210  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
3211  __pyx_r = NULL;
3212  goto __pyx_L2;
3213  __pyx_L0:;
3214  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
3215  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
3216  __pyx_L2:;
3217  __Pyx_XGIVEREF(__pyx_r);
3218  __Pyx_RefNannyFinishContext();
3219  return __pyx_r;
3220 }
3221 
3222 /* "subsurfaceTransportFunctions.pyx":56
3223  * q_vals[eN,k] = material_functions[material]
3224  *
3225  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
3226  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
3227  * dict material_functions):
3228  */
3229 
3230 /* Python wrapper */
3231 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3232 static char __pyx_doc_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements[] = "\n loop over quadrature array and set \013ec f_j assuming element is material j\n ";
3233 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements = {"setVectorMaterialFunctionOverElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements};
3234 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3235  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
3236  PyArrayObject *__pyx_v_q_vals = 0;
3237  PyObject *__pyx_v_material_functions = 0;
3238  PyObject *__pyx_r = 0;
3239  __Pyx_RefNannyDeclarations
3240  __Pyx_RefNannySetupContext("setVectorMaterialFunctionOverElements (wrapper)", 0);
3241  {
3242  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
3243  PyObject* values[3] = {0,0,0};
3244  if (unlikely(__pyx_kwds)) {
3245  Py_ssize_t kw_args;
3246  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3247  switch (pos_args) {
3248  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3249  CYTHON_FALLTHROUGH;
3250  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3251  CYTHON_FALLTHROUGH;
3252  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3253  CYTHON_FALLTHROUGH;
3254  case 0: break;
3255  default: goto __pyx_L5_argtuple_error;
3256  }
3257  kw_args = PyDict_Size(__pyx_kwds);
3258  switch (pos_args) {
3259  case 0:
3260  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
3261  else goto __pyx_L5_argtuple_error;
3262  CYTHON_FALLTHROUGH;
3263  case 1:
3264  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
3265  else {
3266  __Pyx_RaiseArgtupleInvalid("setVectorMaterialFunctionOverElements", 1, 3, 3, 1); __PYX_ERR(0, 56, __pyx_L3_error)
3267  }
3268  CYTHON_FALLTHROUGH;
3269  case 2:
3270  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
3271  else {
3272  __Pyx_RaiseArgtupleInvalid("setVectorMaterialFunctionOverElements", 1, 3, 3, 2); __PYX_ERR(0, 56, __pyx_L3_error)
3273  }
3274  }
3275  if (unlikely(kw_args > 0)) {
3276  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setVectorMaterialFunctionOverElements") < 0)) __PYX_ERR(0, 56, __pyx_L3_error)
3277  }
3278  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
3279  goto __pyx_L5_argtuple_error;
3280  } else {
3281  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3282  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3283  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3284  }
3285  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[0]);
3286  __pyx_v_q_vals = ((PyArrayObject *)values[1]);
3287  __pyx_v_material_functions = ((PyObject*)values[2]);
3288  }
3289  goto __pyx_L4_argument_unpacking_done;
3290  __pyx_L5_argtuple_error:;
3291  __Pyx_RaiseArgtupleInvalid("setVectorMaterialFunctionOverElements", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 56, __pyx_L3_error)
3292  __pyx_L3_error:;
3293  __Pyx_AddTraceback("subsurfaceTransportFunctions.setVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
3294  __Pyx_RefNannyFinishContext();
3295  return NULL;
3296  __pyx_L4_argument_unpacking_done:;
3297  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 56, __pyx_L1_error)
3298  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) __PYX_ERR(0, 57, __pyx_L1_error)
3299  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 58, __pyx_L1_error)
3300  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements(__pyx_self, __pyx_v_elementMaterialTypes, __pyx_v_q_vals, __pyx_v_material_functions);
3301 
3302  /* function exit code */
3303  goto __pyx_L0;
3304  __pyx_L1_error:;
3305  __pyx_r = NULL;
3306  __pyx_L0:;
3307  __Pyx_RefNannyFinishContext();
3308  return __pyx_r;
3309 }
3310 
3311 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
3312  int __pyx_v_eN;
3313  int __pyx_v_k;
3314  int __pyx_v_material;
3315  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
3316  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
3317  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
3318  __Pyx_Buffer __pyx_pybuffer_q_vals;
3319  PyObject *__pyx_r = NULL;
3320  __Pyx_RefNannyDeclarations
3321  npy_intp __pyx_t_1;
3322  npy_intp __pyx_t_2;
3323  int __pyx_t_3;
3324  Py_ssize_t __pyx_t_4;
3325  int __pyx_t_5;
3326  npy_intp __pyx_t_6;
3327  npy_intp __pyx_t_7;
3328  PyObject *__pyx_t_8 = NULL;
3329  PyObject *__pyx_t_9 = NULL;
3330  PyObject *__pyx_t_10 = NULL;
3331  PyObject *__pyx_t_11 = NULL;
3332  __Pyx_RefNannySetupContext("setVectorMaterialFunctionOverElements", 0);
3333  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
3334  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
3335  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
3336  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
3337  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
3338  __pyx_pybuffer_q_vals.refcount = 0;
3339  __pyx_pybuffernd_q_vals.data = NULL;
3340  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
3341  {
3342  __Pyx_BufFmt_StackElem __pyx_stack[1];
3343  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 56, __pyx_L1_error)
3344  }
3345  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
3346  {
3347  __Pyx_BufFmt_StackElem __pyx_stack[1];
3348  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 56, __pyx_L1_error)
3349  }
3350  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_vals.diminfo[2].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_vals.diminfo[2].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[2];
3351 
3352  /* "subsurfaceTransportFunctions.pyx":63
3353  * """
3354  * cdef int eN,k,material
3355  * for eN in range(q_vals.shape[0]): # <<<<<<<<<<<<<<
3356  * material = elementMaterialTypes[eN]
3357  * for k in range(q_vals.shape[1]):
3358  */
3359  __pyx_t_1 = (__pyx_v_q_vals->dimensions[0]);
3360  __pyx_t_2 = __pyx_t_1;
3361  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3362  __pyx_v_eN = __pyx_t_3;
3363 
3364  /* "subsurfaceTransportFunctions.pyx":64
3365  * cdef int eN,k,material
3366  * for eN in range(q_vals.shape[0]):
3367  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
3368  * for k in range(q_vals.shape[1]):
3369  * q_vals[eN,k,:] = material_functions[material].flat
3370  */
3371  __pyx_t_4 = __pyx_v_eN;
3372  __pyx_t_5 = -1;
3373  if (__pyx_t_4 < 0) {
3374  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
3375  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
3376  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
3377  if (unlikely(__pyx_t_5 != -1)) {
3378  __Pyx_RaiseBufferIndexError(__pyx_t_5);
3379  __PYX_ERR(0, 64, __pyx_L1_error)
3380  }
3381  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
3382 
3383  /* "subsurfaceTransportFunctions.pyx":65
3384  * for eN in range(q_vals.shape[0]):
3385  * material = elementMaterialTypes[eN]
3386  * for k in range(q_vals.shape[1]): # <<<<<<<<<<<<<<
3387  * q_vals[eN,k,:] = material_functions[material].flat
3388  *
3389  */
3390  __pyx_t_6 = (__pyx_v_q_vals->dimensions[1]);
3391  __pyx_t_7 = __pyx_t_6;
3392  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_7; __pyx_t_5+=1) {
3393  __pyx_v_k = __pyx_t_5;
3394 
3395  /* "subsurfaceTransportFunctions.pyx":66
3396  * material = elementMaterialTypes[eN]
3397  * for k in range(q_vals.shape[1]):
3398  * q_vals[eN,k,:] = material_functions[material].flat # <<<<<<<<<<<<<<
3399  *
3400  *
3401  */
3402  if (unlikely(__pyx_v_material_functions == Py_None)) {
3403  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3404  __PYX_ERR(0, 66, __pyx_L1_error)
3405  }
3406  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 66, __pyx_L1_error)
3407  __Pyx_GOTREF(__pyx_t_8);
3408  __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 66, __pyx_L1_error)
3409  __Pyx_GOTREF(__pyx_t_9);
3410  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3411  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_flat); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 66, __pyx_L1_error)
3412  __Pyx_GOTREF(__pyx_t_8);
3413  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3414  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 66, __pyx_L1_error)
3415  __Pyx_GOTREF(__pyx_t_9);
3416  __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 66, __pyx_L1_error)
3417  __Pyx_GOTREF(__pyx_t_10);
3418  __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 66, __pyx_L1_error)
3419  __Pyx_GOTREF(__pyx_t_11);
3420  __Pyx_GIVEREF(__pyx_t_9);
3421  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9);
3422  __Pyx_GIVEREF(__pyx_t_10);
3423  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10);
3424  __Pyx_INCREF(__pyx_slice_);
3425  __Pyx_GIVEREF(__pyx_slice_);
3426  PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_slice_);
3427  __pyx_t_9 = 0;
3428  __pyx_t_10 = 0;
3429  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_q_vals), __pyx_t_11, __pyx_t_8) < 0)) __PYX_ERR(0, 66, __pyx_L1_error)
3430  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3431  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3432  }
3433  }
3434 
3435  /* "subsurfaceTransportFunctions.pyx":56
3436  * q_vals[eN,k] = material_functions[material]
3437  *
3438  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
3439  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
3440  * dict material_functions):
3441  */
3442 
3443  /* function exit code */
3444  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3445  goto __pyx_L0;
3446  __pyx_L1_error:;
3447  __Pyx_XDECREF(__pyx_t_8);
3448  __Pyx_XDECREF(__pyx_t_9);
3449  __Pyx_XDECREF(__pyx_t_10);
3450  __Pyx_XDECREF(__pyx_t_11);
3451  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3452  __Pyx_PyThreadState_declare
3453  __Pyx_PyThreadState_assign
3454  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3455  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
3456  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
3457  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3458  __Pyx_AddTraceback("subsurfaceTransportFunctions.setVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
3459  __pyx_r = NULL;
3460  goto __pyx_L2;
3461  __pyx_L0:;
3462  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
3463  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
3464  __pyx_L2:;
3465  __Pyx_XGIVEREF(__pyx_r);
3466  __Pyx_RefNannyFinishContext();
3467  return __pyx_r;
3468 }
3469 
3470 /* "subsurfaceTransportFunctions.pyx":69
3471  *
3472  *
3473  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
3474  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
3475  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
3476  */
3477 
3478 /* Python wrapper */
3479 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3480 static char __pyx_doc_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and set f = 0.5(f^L_j+f^R_k) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
3481 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage = {"setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage};
3482 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3483  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
3484  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
3485  PyArrayObject *__pyx_v_ebq_vals = 0;
3486  PyObject *__pyx_v_material_functions = 0;
3487  PyObject *__pyx_r = 0;
3488  __Pyx_RefNannyDeclarations
3489  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage (wrapper)", 0);
3490  {
3491  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
3492  PyObject* values[4] = {0,0,0,0};
3493  if (unlikely(__pyx_kwds)) {
3494  Py_ssize_t kw_args;
3495  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3496  switch (pos_args) {
3497  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3498  CYTHON_FALLTHROUGH;
3499  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3500  CYTHON_FALLTHROUGH;
3501  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3502  CYTHON_FALLTHROUGH;
3503  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3504  CYTHON_FALLTHROUGH;
3505  case 0: break;
3506  default: goto __pyx_L5_argtuple_error;
3507  }
3508  kw_args = PyDict_Size(__pyx_kwds);
3509  switch (pos_args) {
3510  case 0:
3511  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
3512  else goto __pyx_L5_argtuple_error;
3513  CYTHON_FALLTHROUGH;
3514  case 1:
3515  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
3516  else {
3517  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, 1); __PYX_ERR(0, 69, __pyx_L3_error)
3518  }
3519  CYTHON_FALLTHROUGH;
3520  case 2:
3521  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
3522  else {
3523  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, 2); __PYX_ERR(0, 69, __pyx_L3_error)
3524  }
3525  CYTHON_FALLTHROUGH;
3526  case 3:
3527  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
3528  else {
3529  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, 3); __PYX_ERR(0, 69, __pyx_L3_error)
3530  }
3531  }
3532  if (unlikely(kw_args > 0)) {
3533  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage") < 0)) __PYX_ERR(0, 69, __pyx_L3_error)
3534  }
3535  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
3536  goto __pyx_L5_argtuple_error;
3537  } else {
3538  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3539  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3540  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3541  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3542  }
3543  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[0]);
3544  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[1]);
3545  __pyx_v_ebq_vals = ((PyArrayObject *)values[2]);
3546  __pyx_v_material_functions = ((PyObject*)values[3]);
3547  }
3548  goto __pyx_L4_argument_unpacking_done;
3549  __pyx_L5_argtuple_error:;
3550  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 69, __pyx_L3_error)
3551  __pyx_L3_error:;
3552  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
3553  __Pyx_RefNannyFinishContext();
3554  return NULL;
3555  __pyx_L4_argument_unpacking_done:;
3556  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 69, __pyx_L1_error)
3557  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 70, __pyx_L1_error)
3558  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) __PYX_ERR(0, 71, __pyx_L1_error)
3559  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 72, __pyx_L1_error)
3560  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_vals, __pyx_v_material_functions);
3561 
3562  /* function exit code */
3563  goto __pyx_L0;
3564  __pyx_L1_error:;
3565  __pyx_r = NULL;
3566  __pyx_L0:;
3567  __Pyx_RefNannyFinishContext();
3568  return __pyx_r;
3569 }
3570 
3571 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
3572  int __pyx_v_eN;
3573  int __pyx_v_ebN;
3574  int __pyx_v_ebN_local;
3575  int __pyx_v_k;
3576  int __pyx_v_material_left;
3577  int __pyx_v_material_right;
3578  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
3579  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
3580  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
3581  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
3582  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
3583  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
3584  PyObject *__pyx_r = NULL;
3585  __Pyx_RefNannyDeclarations
3586  npy_intp __pyx_t_1;
3587  npy_intp __pyx_t_2;
3588  int __pyx_t_3;
3589  npy_intp __pyx_t_4;
3590  npy_intp __pyx_t_5;
3591  int __pyx_t_6;
3592  Py_ssize_t __pyx_t_7;
3593  Py_ssize_t __pyx_t_8;
3594  int __pyx_t_9;
3595  Py_ssize_t __pyx_t_10;
3596  Py_ssize_t __pyx_t_11;
3597  Py_ssize_t __pyx_t_12;
3598  Py_ssize_t __pyx_t_13;
3599  npy_intp __pyx_t_14;
3600  npy_intp __pyx_t_15;
3601  PyObject *__pyx_t_16 = NULL;
3602  PyObject *__pyx_t_17 = NULL;
3603  PyObject *__pyx_t_18 = NULL;
3604  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_19;
3605  Py_ssize_t __pyx_t_20;
3606  Py_ssize_t __pyx_t_21;
3607  Py_ssize_t __pyx_t_22;
3608  int __pyx_t_23;
3609  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 0);
3610  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
3611  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
3612  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
3613  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
3614  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
3615  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
3616  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
3617  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
3618  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
3619  __pyx_pybuffer_ebq_vals.refcount = 0;
3620  __pyx_pybuffernd_ebq_vals.data = NULL;
3621  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
3622  {
3623  __Pyx_BufFmt_StackElem __pyx_stack[1];
3624  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 69, __pyx_L1_error)
3625  }
3626  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
3627  {
3628  __Pyx_BufFmt_StackElem __pyx_stack[1];
3629  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 69, __pyx_L1_error)
3630  }
3631  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
3632  {
3633  __Pyx_BufFmt_StackElem __pyx_stack[1];
3634  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 69, __pyx_L1_error)
3635  }
3636  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2];
3637 
3638  /* "subsurfaceTransportFunctions.pyx":82
3639  * cdef int eN,ebN,ebN_local,k,material_left,material_right
3640  *
3641  * for eN in range(ebq_vals.shape[0]): # <<<<<<<<<<<<<<
3642  * for ebN_local in range(ebq_vals.shape[1]):
3643  * ebN = elementBoundariesArray[eN,ebN_local]
3644  */
3645  __pyx_t_1 = (__pyx_v_ebq_vals->dimensions[0]);
3646  __pyx_t_2 = __pyx_t_1;
3647  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3648  __pyx_v_eN = __pyx_t_3;
3649 
3650  /* "subsurfaceTransportFunctions.pyx":83
3651  *
3652  * for eN in range(ebq_vals.shape[0]):
3653  * for ebN_local in range(ebq_vals.shape[1]): # <<<<<<<<<<<<<<
3654  * ebN = elementBoundariesArray[eN,ebN_local]
3655  * material_left = elementBoundaryTypes[ebN,0]
3656  */
3657  __pyx_t_4 = (__pyx_v_ebq_vals->dimensions[1]);
3658  __pyx_t_5 = __pyx_t_4;
3659  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
3660  __pyx_v_ebN_local = __pyx_t_6;
3661 
3662  /* "subsurfaceTransportFunctions.pyx":84
3663  * for eN in range(ebq_vals.shape[0]):
3664  * for ebN_local in range(ebq_vals.shape[1]):
3665  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
3666  * material_left = elementBoundaryTypes[ebN,0]
3667  * material_right= elementBoundaryTypes[ebN,1]
3668  */
3669  __pyx_t_7 = __pyx_v_eN;
3670  __pyx_t_8 = __pyx_v_ebN_local;
3671  __pyx_t_9 = -1;
3672  if (__pyx_t_7 < 0) {
3673  __pyx_t_7 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
3674  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
3675  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_9 = 0;
3676  if (__pyx_t_8 < 0) {
3677  __pyx_t_8 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
3678  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
3679  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_9 = 1;
3680  if (unlikely(__pyx_t_9 != -1)) {
3681  __Pyx_RaiseBufferIndexError(__pyx_t_9);
3682  __PYX_ERR(0, 84, __pyx_L1_error)
3683  }
3684  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
3685 
3686  /* "subsurfaceTransportFunctions.pyx":85
3687  * for ebN_local in range(ebq_vals.shape[1]):
3688  * ebN = elementBoundariesArray[eN,ebN_local]
3689  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
3690  * material_right= elementBoundaryTypes[ebN,1]
3691  * for k in range(ebq_vals.shape[2]):
3692  */
3693  __pyx_t_10 = __pyx_v_ebN;
3694  __pyx_t_11 = 0;
3695  __pyx_t_9 = -1;
3696  if (__pyx_t_10 < 0) {
3697  __pyx_t_10 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
3698  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
3699  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
3700  if (__pyx_t_11 < 0) {
3701  __pyx_t_11 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
3702  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
3703  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
3704  if (unlikely(__pyx_t_9 != -1)) {
3705  __Pyx_RaiseBufferIndexError(__pyx_t_9);
3706  __PYX_ERR(0, 85, __pyx_L1_error)
3707  }
3708  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
3709 
3710  /* "subsurfaceTransportFunctions.pyx":86
3711  * ebN = elementBoundariesArray[eN,ebN_local]
3712  * material_left = elementBoundaryTypes[ebN,0]
3713  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
3714  * for k in range(ebq_vals.shape[2]):
3715  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+
3716  */
3717  __pyx_t_12 = __pyx_v_ebN;
3718  __pyx_t_13 = 1;
3719  __pyx_t_9 = -1;
3720  if (__pyx_t_12 < 0) {
3721  __pyx_t_12 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
3722  if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 0;
3723  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
3724  if (__pyx_t_13 < 0) {
3725  __pyx_t_13 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
3726  if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 1;
3727  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
3728  if (unlikely(__pyx_t_9 != -1)) {
3729  __Pyx_RaiseBufferIndexError(__pyx_t_9);
3730  __PYX_ERR(0, 86, __pyx_L1_error)
3731  }
3732  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
3733 
3734  /* "subsurfaceTransportFunctions.pyx":87
3735  * material_left = elementBoundaryTypes[ebN,0]
3736  * material_right= elementBoundaryTypes[ebN,1]
3737  * for k in range(ebq_vals.shape[2]): # <<<<<<<<<<<<<<
3738  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+
3739  * material_functions[material_right])
3740  */
3741  __pyx_t_14 = (__pyx_v_ebq_vals->dimensions[2]);
3742  __pyx_t_15 = __pyx_t_14;
3743  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_15; __pyx_t_9+=1) {
3744  __pyx_v_k = __pyx_t_9;
3745 
3746  /* "subsurfaceTransportFunctions.pyx":88
3747  * material_right= elementBoundaryTypes[ebN,1]
3748  * for k in range(ebq_vals.shape[2]):
3749  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
3750  * material_functions[material_right])
3751  *
3752  */
3753  if (unlikely(__pyx_v_material_functions == Py_None)) {
3754  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3755  __PYX_ERR(0, 88, __pyx_L1_error)
3756  }
3757  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 88, __pyx_L1_error)
3758  __Pyx_GOTREF(__pyx_t_16);
3759  __pyx_t_17 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_16); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 88, __pyx_L1_error)
3760  __Pyx_GOTREF(__pyx_t_17);
3761  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
3762 
3763  /* "subsurfaceTransportFunctions.pyx":89
3764  * for k in range(ebq_vals.shape[2]):
3765  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+
3766  * material_functions[material_right]) # <<<<<<<<<<<<<<
3767  *
3768  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd,
3769  */
3770  if (unlikely(__pyx_v_material_functions == Py_None)) {
3771  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3772  __PYX_ERR(0, 89, __pyx_L1_error)
3773  }
3774  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 89, __pyx_L1_error)
3775  __Pyx_GOTREF(__pyx_t_16);
3776  __pyx_t_18 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_16); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 89, __pyx_L1_error)
3777  __Pyx_GOTREF(__pyx_t_18);
3778  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
3779 
3780  /* "subsurfaceTransportFunctions.pyx":88
3781  * material_right= elementBoundaryTypes[ebN,1]
3782  * for k in range(ebq_vals.shape[2]):
3783  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
3784  * material_functions[material_right])
3785  *
3786  */
3787  __pyx_t_16 = PyNumber_Add(__pyx_t_17, __pyx_t_18); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 88, __pyx_L1_error)
3788  __Pyx_GOTREF(__pyx_t_16);
3789  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
3790  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
3791  __pyx_t_18 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_16); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 88, __pyx_L1_error)
3792  __Pyx_GOTREF(__pyx_t_18);
3793  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
3794  __pyx_t_19 = __pyx_PyFloat_AsDouble(__pyx_t_18); if (unlikely((__pyx_t_19 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 88, __pyx_L1_error)
3795  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
3796  __pyx_t_20 = __pyx_v_eN;
3797  __pyx_t_21 = __pyx_v_ebN_local;
3798  __pyx_t_22 = __pyx_v_k;
3799  __pyx_t_23 = -1;
3800  if (__pyx_t_20 < 0) {
3801  __pyx_t_20 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
3802  if (unlikely(__pyx_t_20 < 0)) __pyx_t_23 = 0;
3803  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_23 = 0;
3804  if (__pyx_t_21 < 0) {
3805  __pyx_t_21 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
3806  if (unlikely(__pyx_t_21 < 0)) __pyx_t_23 = 1;
3807  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_23 = 1;
3808  if (__pyx_t_22 < 0) {
3809  __pyx_t_22 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
3810  if (unlikely(__pyx_t_22 < 0)) __pyx_t_23 = 2;
3811  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_23 = 2;
3812  if (unlikely(__pyx_t_23 != -1)) {
3813  __Pyx_RaiseBufferIndexError(__pyx_t_23);
3814  __PYX_ERR(0, 88, __pyx_L1_error)
3815  }
3816  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_22, __pyx_pybuffernd_ebq_vals.diminfo[2].strides) = __pyx_t_19;
3817  }
3818  }
3819  }
3820 
3821  /* "subsurfaceTransportFunctions.pyx":69
3822  *
3823  *
3824  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
3825  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
3826  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
3827  */
3828 
3829  /* function exit code */
3830  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3831  goto __pyx_L0;
3832  __pyx_L1_error:;
3833  __Pyx_XDECREF(__pyx_t_16);
3834  __Pyx_XDECREF(__pyx_t_17);
3835  __Pyx_XDECREF(__pyx_t_18);
3836  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3837  __Pyx_PyThreadState_declare
3838  __Pyx_PyThreadState_assign
3839  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3840  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
3841  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
3842  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
3843  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3844  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
3845  __pyx_r = NULL;
3846  goto __pyx_L2;
3847  __pyx_L0:;
3848  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
3849  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
3850  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
3851  __pyx_L2:;
3852  __Pyx_XGIVEREF(__pyx_r);
3853  __Pyx_RefNannyFinishContext();
3854  return __pyx_r;
3855 }
3856 
3857 /* "subsurfaceTransportFunctions.pyx":91
3858  * material_functions[material_right])
3859  *
3860  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
3861  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
3862  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
3863  */
3864 
3865 /* Python wrapper */
3866 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3867 static char __pyx_doc_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn} = f^L_{j,mn} f^R_{k,mn}/(f^L_{j,mn}+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
3868 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage = {"setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage};
3869 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3870  int __pyx_v_nd;
3871  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
3872  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
3873  PyArrayObject *__pyx_v_ebq_vals = 0;
3874  PyObject *__pyx_v_material_functions = 0;
3875  PyObject *__pyx_r = 0;
3876  __Pyx_RefNannyDeclarations
3877  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage (wrapper)", 0);
3878  {
3879  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
3880  PyObject* values[5] = {0,0,0,0,0};
3881  if (unlikely(__pyx_kwds)) {
3882  Py_ssize_t kw_args;
3883  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3884  switch (pos_args) {
3885  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3886  CYTHON_FALLTHROUGH;
3887  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3888  CYTHON_FALLTHROUGH;
3889  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3890  CYTHON_FALLTHROUGH;
3891  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3892  CYTHON_FALLTHROUGH;
3893  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3894  CYTHON_FALLTHROUGH;
3895  case 0: break;
3896  default: goto __pyx_L5_argtuple_error;
3897  }
3898  kw_args = PyDict_Size(__pyx_kwds);
3899  switch (pos_args) {
3900  case 0:
3901  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
3902  else goto __pyx_L5_argtuple_error;
3903  CYTHON_FALLTHROUGH;
3904  case 1:
3905  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
3906  else {
3907  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 1); __PYX_ERR(0, 91, __pyx_L3_error)
3908  }
3909  CYTHON_FALLTHROUGH;
3910  case 2:
3911  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
3912  else {
3913  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 2); __PYX_ERR(0, 91, __pyx_L3_error)
3914  }
3915  CYTHON_FALLTHROUGH;
3916  case 3:
3917  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
3918  else {
3919  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 3); __PYX_ERR(0, 91, __pyx_L3_error)
3920  }
3921  CYTHON_FALLTHROUGH;
3922  case 4:
3923  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
3924  else {
3925  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 4); __PYX_ERR(0, 91, __pyx_L3_error)
3926  }
3927  }
3928  if (unlikely(kw_args > 0)) {
3929  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage") < 0)) __PYX_ERR(0, 91, __pyx_L3_error)
3930  }
3931  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
3932  goto __pyx_L5_argtuple_error;
3933  } else {
3934  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3935  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3936  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3937  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3938  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3939  }
3940  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L3_error)
3941  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
3942  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
3943  __pyx_v_ebq_vals = ((PyArrayObject *)values[3]);
3944  __pyx_v_material_functions = ((PyObject*)values[4]);
3945  }
3946  goto __pyx_L4_argument_unpacking_done;
3947  __pyx_L5_argtuple_error:;
3948  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 91, __pyx_L3_error)
3949  __pyx_L3_error:;
3950  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
3951  __Pyx_RefNannyFinishContext();
3952  return NULL;
3953  __pyx_L4_argument_unpacking_done:;
3954  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 92, __pyx_L1_error)
3955  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 93, __pyx_L1_error)
3956  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) __PYX_ERR(0, 94, __pyx_L1_error)
3957  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 95, __pyx_L1_error)
3958  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_vals, __pyx_v_material_functions);
3959 
3960  /* function exit code */
3961  goto __pyx_L0;
3962  __pyx_L1_error:;
3963  __pyx_r = NULL;
3964  __pyx_L0:;
3965  __Pyx_RefNannyFinishContext();
3966  return __pyx_r;
3967 }
3968 
3969 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
3970  int __pyx_v_eN;
3971  int __pyx_v_ebN;
3972  int __pyx_v_ebN_local;
3973  int __pyx_v_k;
3974  int __pyx_v_material_left;
3975  int __pyx_v_material_right;
3976  int __pyx_v_I;
3977  int __pyx_v_J;
3978  double __pyx_v_numer;
3979  double __pyx_v_denom;
3980  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
3981  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
3982  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
3983  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
3984  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
3985  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
3986  PyObject *__pyx_r = NULL;
3987  __Pyx_RefNannyDeclarations
3988  npy_intp __pyx_t_1;
3989  npy_intp __pyx_t_2;
3990  int __pyx_t_3;
3991  npy_intp __pyx_t_4;
3992  npy_intp __pyx_t_5;
3993  int __pyx_t_6;
3994  Py_ssize_t __pyx_t_7;
3995  Py_ssize_t __pyx_t_8;
3996  int __pyx_t_9;
3997  Py_ssize_t __pyx_t_10;
3998  Py_ssize_t __pyx_t_11;
3999  Py_ssize_t __pyx_t_12;
4000  Py_ssize_t __pyx_t_13;
4001  npy_intp __pyx_t_14;
4002  npy_intp __pyx_t_15;
4003  int __pyx_t_16;
4004  int __pyx_t_17;
4005  int __pyx_t_18;
4006  int __pyx_t_19;
4007  int __pyx_t_20;
4008  int __pyx_t_21;
4009  PyObject *__pyx_t_22 = NULL;
4010  PyObject *__pyx_t_23 = NULL;
4011  PyObject *__pyx_t_24 = NULL;
4012  PyObject *__pyx_t_25 = NULL;
4013  PyObject *__pyx_t_26 = NULL;
4014  double __pyx_t_27;
4015  Py_ssize_t __pyx_t_28;
4016  Py_ssize_t __pyx_t_29;
4017  Py_ssize_t __pyx_t_30;
4018  Py_ssize_t __pyx_t_31;
4019  int __pyx_t_32;
4020  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 0);
4021  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
4022  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
4023  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
4024  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
4025  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
4026  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
4027  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
4028  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
4029  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
4030  __pyx_pybuffer_ebq_vals.refcount = 0;
4031  __pyx_pybuffernd_ebq_vals.data = NULL;
4032  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
4033  {
4034  __Pyx_BufFmt_StackElem __pyx_stack[1];
4035  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 91, __pyx_L1_error)
4036  }
4037  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
4038  {
4039  __Pyx_BufFmt_StackElem __pyx_stack[1];
4040  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 91, __pyx_L1_error)
4041  }
4042  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
4043  {
4044  __Pyx_BufFmt_StackElem __pyx_stack[1];
4045  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 91, __pyx_L1_error)
4046  }
4047  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_ebq_vals.diminfo[3].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_ebq_vals.diminfo[3].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[3];
4048 
4049  /* "subsurfaceTransportFunctions.pyx":106
4050  * cdef double numer,denom
4051  *
4052  * for eN in range(ebq_vals.shape[0]): # <<<<<<<<<<<<<<
4053  * for ebN_local in range(ebq_vals.shape[1]):
4054  * ebN = elementBoundariesArray[eN,ebN_local]
4055  */
4056  __pyx_t_1 = (__pyx_v_ebq_vals->dimensions[0]);
4057  __pyx_t_2 = __pyx_t_1;
4058  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
4059  __pyx_v_eN = __pyx_t_3;
4060 
4061  /* "subsurfaceTransportFunctions.pyx":107
4062  *
4063  * for eN in range(ebq_vals.shape[0]):
4064  * for ebN_local in range(ebq_vals.shape[1]): # <<<<<<<<<<<<<<
4065  * ebN = elementBoundariesArray[eN,ebN_local]
4066  * material_left = elementBoundaryTypes[ebN,0]
4067  */
4068  __pyx_t_4 = (__pyx_v_ebq_vals->dimensions[1]);
4069  __pyx_t_5 = __pyx_t_4;
4070  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
4071  __pyx_v_ebN_local = __pyx_t_6;
4072 
4073  /* "subsurfaceTransportFunctions.pyx":108
4074  * for eN in range(ebq_vals.shape[0]):
4075  * for ebN_local in range(ebq_vals.shape[1]):
4076  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
4077  * material_left = elementBoundaryTypes[ebN,0]
4078  * material_right= elementBoundaryTypes[ebN,1]
4079  */
4080  __pyx_t_7 = __pyx_v_eN;
4081  __pyx_t_8 = __pyx_v_ebN_local;
4082  __pyx_t_9 = -1;
4083  if (__pyx_t_7 < 0) {
4084  __pyx_t_7 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
4085  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
4086  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_9 = 0;
4087  if (__pyx_t_8 < 0) {
4088  __pyx_t_8 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
4089  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
4090  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_9 = 1;
4091  if (unlikely(__pyx_t_9 != -1)) {
4092  __Pyx_RaiseBufferIndexError(__pyx_t_9);
4093  __PYX_ERR(0, 108, __pyx_L1_error)
4094  }
4095  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
4096 
4097  /* "subsurfaceTransportFunctions.pyx":109
4098  * for ebN_local in range(ebq_vals.shape[1]):
4099  * ebN = elementBoundariesArray[eN,ebN_local]
4100  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
4101  * material_right= elementBoundaryTypes[ebN,1]
4102  * for k in range(ebq_vals.shape[2]):
4103  */
4104  __pyx_t_10 = __pyx_v_ebN;
4105  __pyx_t_11 = 0;
4106  __pyx_t_9 = -1;
4107  if (__pyx_t_10 < 0) {
4108  __pyx_t_10 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4109  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
4110  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
4111  if (__pyx_t_11 < 0) {
4112  __pyx_t_11 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4113  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
4114  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
4115  if (unlikely(__pyx_t_9 != -1)) {
4116  __Pyx_RaiseBufferIndexError(__pyx_t_9);
4117  __PYX_ERR(0, 109, __pyx_L1_error)
4118  }
4119  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4120 
4121  /* "subsurfaceTransportFunctions.pyx":110
4122  * ebN = elementBoundariesArray[eN,ebN_local]
4123  * material_left = elementBoundaryTypes[ebN,0]
4124  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
4125  * for k in range(ebq_vals.shape[2]):
4126  * for I in range(nd):
4127  */
4128  __pyx_t_12 = __pyx_v_ebN;
4129  __pyx_t_13 = 1;
4130  __pyx_t_9 = -1;
4131  if (__pyx_t_12 < 0) {
4132  __pyx_t_12 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4133  if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 0;
4134  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
4135  if (__pyx_t_13 < 0) {
4136  __pyx_t_13 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4137  if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 1;
4138  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
4139  if (unlikely(__pyx_t_9 != -1)) {
4140  __Pyx_RaiseBufferIndexError(__pyx_t_9);
4141  __PYX_ERR(0, 110, __pyx_L1_error)
4142  }
4143  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4144 
4145  /* "subsurfaceTransportFunctions.pyx":111
4146  * material_left = elementBoundaryTypes[ebN,0]
4147  * material_right= elementBoundaryTypes[ebN,1]
4148  * for k in range(ebq_vals.shape[2]): # <<<<<<<<<<<<<<
4149  * for I in range(nd):
4150  * for J in range(nd):
4151  */
4152  __pyx_t_14 = (__pyx_v_ebq_vals->dimensions[2]);
4153  __pyx_t_15 = __pyx_t_14;
4154  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_15; __pyx_t_9+=1) {
4155  __pyx_v_k = __pyx_t_9;
4156 
4157  /* "subsurfaceTransportFunctions.pyx":112
4158  * material_right= elementBoundaryTypes[ebN,1]
4159  * for k in range(ebq_vals.shape[2]):
4160  * for I in range(nd): # <<<<<<<<<<<<<<
4161  * for J in range(nd):
4162  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4163  */
4164  __pyx_t_16 = __pyx_v_nd;
4165  __pyx_t_17 = __pyx_t_16;
4166  for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
4167  __pyx_v_I = __pyx_t_18;
4168 
4169  /* "subsurfaceTransportFunctions.pyx":113
4170  * for k in range(ebq_vals.shape[2]):
4171  * for I in range(nd):
4172  * for J in range(nd): # <<<<<<<<<<<<<<
4173  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4174  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
4175  */
4176  __pyx_t_19 = __pyx_v_nd;
4177  __pyx_t_20 = __pyx_t_19;
4178  for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
4179  __pyx_v_J = __pyx_t_21;
4180 
4181  /* "subsurfaceTransportFunctions.pyx":114
4182  * for I in range(nd):
4183  * for J in range(nd):
4184  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J] # <<<<<<<<<<<<<<
4185  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
4186  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
4187  */
4188  if (unlikely(__pyx_v_material_functions == Py_None)) {
4189  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4190  __PYX_ERR(0, 114, __pyx_L1_error)
4191  }
4192  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 114, __pyx_L1_error)
4193  __Pyx_GOTREF(__pyx_t_22);
4194  __pyx_t_23 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_22); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 114, __pyx_L1_error)
4195  __Pyx_GOTREF(__pyx_t_23);
4196  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
4197  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 114, __pyx_L1_error)
4198  __Pyx_GOTREF(__pyx_t_22);
4199  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 114, __pyx_L1_error)
4200  __Pyx_GOTREF(__pyx_t_24);
4201  __pyx_t_25 = PyTuple_New(2); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 114, __pyx_L1_error)
4202  __Pyx_GOTREF(__pyx_t_25);
4203  __Pyx_GIVEREF(__pyx_t_22);
4204  PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_22);
4205  __Pyx_GIVEREF(__pyx_t_24);
4206  PyTuple_SET_ITEM(__pyx_t_25, 1, __pyx_t_24);
4207  __pyx_t_22 = 0;
4208  __pyx_t_24 = 0;
4209  __pyx_t_24 = __Pyx_PyObject_GetItem(__pyx_t_23, __pyx_t_25); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 114, __pyx_L1_error)
4210  __Pyx_GOTREF(__pyx_t_24);
4211  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
4212  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
4213  __pyx_t_25 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_24); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 114, __pyx_L1_error)
4214  __Pyx_GOTREF(__pyx_t_25);
4215  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
4216  if (unlikely(__pyx_v_material_functions == Py_None)) {
4217  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4218  __PYX_ERR(0, 114, __pyx_L1_error)
4219  }
4220  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 114, __pyx_L1_error)
4221  __Pyx_GOTREF(__pyx_t_24);
4222  __pyx_t_23 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_24); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 114, __pyx_L1_error)
4223  __Pyx_GOTREF(__pyx_t_23);
4224  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
4225  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 114, __pyx_L1_error)
4226  __Pyx_GOTREF(__pyx_t_24);
4227  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 114, __pyx_L1_error)
4228  __Pyx_GOTREF(__pyx_t_22);
4229  __pyx_t_26 = PyTuple_New(2); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 114, __pyx_L1_error)
4230  __Pyx_GOTREF(__pyx_t_26);
4231  __Pyx_GIVEREF(__pyx_t_24);
4232  PyTuple_SET_ITEM(__pyx_t_26, 0, __pyx_t_24);
4233  __Pyx_GIVEREF(__pyx_t_22);
4234  PyTuple_SET_ITEM(__pyx_t_26, 1, __pyx_t_22);
4235  __pyx_t_24 = 0;
4236  __pyx_t_22 = 0;
4237  __pyx_t_22 = __Pyx_PyObject_GetItem(__pyx_t_23, __pyx_t_26); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 114, __pyx_L1_error)
4238  __Pyx_GOTREF(__pyx_t_22);
4239  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
4240  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
4241  __pyx_t_26 = PyNumber_Multiply(__pyx_t_25, __pyx_t_22); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 114, __pyx_L1_error)
4242  __Pyx_GOTREF(__pyx_t_26);
4243  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
4244  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
4245  __pyx_t_27 = __pyx_PyFloat_AsDouble(__pyx_t_26); if (unlikely((__pyx_t_27 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 114, __pyx_L1_error)
4246  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
4247  __pyx_v_numer = __pyx_t_27;
4248 
4249  /* "subsurfaceTransportFunctions.pyx":115
4250  * for J in range(nd):
4251  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4252  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20 # <<<<<<<<<<<<<<
4253  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
4254  *
4255  */
4256  if (unlikely(__pyx_v_material_functions == Py_None)) {
4257  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4258  __PYX_ERR(0, 115, __pyx_L1_error)
4259  }
4260  __pyx_t_26 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 115, __pyx_L1_error)
4261  __Pyx_GOTREF(__pyx_t_26);
4262  __pyx_t_22 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_26); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 115, __pyx_L1_error)
4263  __Pyx_GOTREF(__pyx_t_22);
4264  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
4265  __pyx_t_26 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 115, __pyx_L1_error)
4266  __Pyx_GOTREF(__pyx_t_26);
4267  __pyx_t_25 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 115, __pyx_L1_error)
4268  __Pyx_GOTREF(__pyx_t_25);
4269  __pyx_t_23 = PyTuple_New(2); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 115, __pyx_L1_error)
4270  __Pyx_GOTREF(__pyx_t_23);
4271  __Pyx_GIVEREF(__pyx_t_26);
4272  PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_26);
4273  __Pyx_GIVEREF(__pyx_t_25);
4274  PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_t_25);
4275  __pyx_t_26 = 0;
4276  __pyx_t_25 = 0;
4277  __pyx_t_25 = __Pyx_PyObject_GetItem(__pyx_t_22, __pyx_t_23); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 115, __pyx_L1_error)
4278  __Pyx_GOTREF(__pyx_t_25);
4279  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
4280  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
4281  if (unlikely(__pyx_v_material_functions == Py_None)) {
4282  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4283  __PYX_ERR(0, 115, __pyx_L1_error)
4284  }
4285  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 115, __pyx_L1_error)
4286  __Pyx_GOTREF(__pyx_t_23);
4287  __pyx_t_22 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_23); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 115, __pyx_L1_error)
4288  __Pyx_GOTREF(__pyx_t_22);
4289  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
4290  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 115, __pyx_L1_error)
4291  __Pyx_GOTREF(__pyx_t_23);
4292  __pyx_t_26 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 115, __pyx_L1_error)
4293  __Pyx_GOTREF(__pyx_t_26);
4294  __pyx_t_24 = PyTuple_New(2); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 115, __pyx_L1_error)
4295  __Pyx_GOTREF(__pyx_t_24);
4296  __Pyx_GIVEREF(__pyx_t_23);
4297  PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_23);
4298  __Pyx_GIVEREF(__pyx_t_26);
4299  PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_26);
4300  __pyx_t_23 = 0;
4301  __pyx_t_26 = 0;
4302  __pyx_t_26 = __Pyx_PyObject_GetItem(__pyx_t_22, __pyx_t_24); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 115, __pyx_L1_error)
4303  __Pyx_GOTREF(__pyx_t_26);
4304  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
4305  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
4306  __pyx_t_24 = PyNumber_Add(__pyx_t_25, __pyx_t_26); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 115, __pyx_L1_error)
4307  __Pyx_GOTREF(__pyx_t_24);
4308  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
4309  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
4310  __pyx_t_26 = __Pyx_PyFloat_AddObjC(__pyx_t_24, __pyx_float_1_0eneg_20, 1.0e-20, 0, 0); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 115, __pyx_L1_error)
4311  __Pyx_GOTREF(__pyx_t_26);
4312  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
4313  __pyx_t_27 = __pyx_PyFloat_AsDouble(__pyx_t_26); if (unlikely((__pyx_t_27 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L1_error)
4314  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
4315  __pyx_v_denom = __pyx_t_27;
4316 
4317  /* "subsurfaceTransportFunctions.pyx":116
4318  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4319  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
4320  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
4321  *
4322  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
4323  */
4324  if (unlikely(__pyx_v_denom == 0)) {
4325  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
4326  __PYX_ERR(0, 116, __pyx_L1_error)
4327  }
4328  __pyx_t_28 = __pyx_v_eN;
4329  __pyx_t_29 = __pyx_v_ebN_local;
4330  __pyx_t_30 = __pyx_v_k;
4331  __pyx_t_31 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
4332  __pyx_t_32 = -1;
4333  if (__pyx_t_28 < 0) {
4334  __pyx_t_28 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
4335  if (unlikely(__pyx_t_28 < 0)) __pyx_t_32 = 0;
4336  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_32 = 0;
4337  if (__pyx_t_29 < 0) {
4338  __pyx_t_29 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
4339  if (unlikely(__pyx_t_29 < 0)) __pyx_t_32 = 1;
4340  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_32 = 1;
4341  if (__pyx_t_30 < 0) {
4342  __pyx_t_30 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
4343  if (unlikely(__pyx_t_30 < 0)) __pyx_t_32 = 2;
4344  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_32 = 2;
4345  if (__pyx_t_31 < 0) {
4346  __pyx_t_31 += __pyx_pybuffernd_ebq_vals.diminfo[3].shape;
4347  if (unlikely(__pyx_t_31 < 0)) __pyx_t_32 = 3;
4348  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_ebq_vals.diminfo[3].shape)) __pyx_t_32 = 3;
4349  if (unlikely(__pyx_t_32 != -1)) {
4350  __Pyx_RaiseBufferIndexError(__pyx_t_32);
4351  __PYX_ERR(0, 116, __pyx_L1_error)
4352  }
4353  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_30, __pyx_pybuffernd_ebq_vals.diminfo[2].strides, __pyx_t_31, __pyx_pybuffernd_ebq_vals.diminfo[3].strides) = (__pyx_v_numer / __pyx_v_denom);
4354  }
4355  }
4356  }
4357  }
4358  }
4359 
4360  /* "subsurfaceTransportFunctions.pyx":91
4361  * material_functions[material_right])
4362  *
4363  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
4364  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
4365  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4366  */
4367 
4368  /* function exit code */
4369  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4370  goto __pyx_L0;
4371  __pyx_L1_error:;
4372  __Pyx_XDECREF(__pyx_t_22);
4373  __Pyx_XDECREF(__pyx_t_23);
4374  __Pyx_XDECREF(__pyx_t_24);
4375  __Pyx_XDECREF(__pyx_t_25);
4376  __Pyx_XDECREF(__pyx_t_26);
4377  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4378  __Pyx_PyThreadState_declare
4379  __Pyx_PyThreadState_assign
4380  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4381  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
4382  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4383  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4384  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4385  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4386  __pyx_r = NULL;
4387  goto __pyx_L2;
4388  __pyx_L0:;
4389  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
4390  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4391  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4392  __pyx_L2:;
4393  __Pyx_XGIVEREF(__pyx_r);
4394  __Pyx_RefNannyFinishContext();
4395  return __pyx_r;
4396 }
4397 
4398 /* "subsurfaceTransportFunctions.pyx":118
4399  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
4400  *
4401  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
4402  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4403  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
4404  */
4405 
4406 /* Python wrapper */
4407 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4408 static char __pyx_doc_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and evaluate function f = 0.5(f^L_j+f^R_k) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
4409 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage = {"setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage};
4410 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4411  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
4412  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
4413  PyArrayObject *__pyx_v_ebq_global_vals = 0;
4414  PyObject *__pyx_v_material_functions = 0;
4415  PyObject *__pyx_r = 0;
4416  __Pyx_RefNannyDeclarations
4417  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage (wrapper)", 0);
4418  {
4419  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
4420  PyObject* values[4] = {0,0,0,0};
4421  if (unlikely(__pyx_kwds)) {
4422  Py_ssize_t kw_args;
4423  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4424  switch (pos_args) {
4425  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4426  CYTHON_FALLTHROUGH;
4427  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4428  CYTHON_FALLTHROUGH;
4429  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4430  CYTHON_FALLTHROUGH;
4431  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4432  CYTHON_FALLTHROUGH;
4433  case 0: break;
4434  default: goto __pyx_L5_argtuple_error;
4435  }
4436  kw_args = PyDict_Size(__pyx_kwds);
4437  switch (pos_args) {
4438  case 0:
4439  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
4440  else goto __pyx_L5_argtuple_error;
4441  CYTHON_FALLTHROUGH;
4442  case 1:
4443  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
4444  else {
4445  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, 1); __PYX_ERR(0, 118, __pyx_L3_error)
4446  }
4447  CYTHON_FALLTHROUGH;
4448  case 2:
4449  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
4450  else {
4451  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, 2); __PYX_ERR(0, 118, __pyx_L3_error)
4452  }
4453  CYTHON_FALLTHROUGH;
4454  case 3:
4455  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
4456  else {
4457  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, 3); __PYX_ERR(0, 118, __pyx_L3_error)
4458  }
4459  }
4460  if (unlikely(kw_args > 0)) {
4461  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage") < 0)) __PYX_ERR(0, 118, __pyx_L3_error)
4462  }
4463  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
4464  goto __pyx_L5_argtuple_error;
4465  } else {
4466  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4467  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4468  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4469  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4470  }
4471  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[0]);
4472  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[1]);
4473  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[2]);
4474  __pyx_v_material_functions = ((PyObject*)values[3]);
4475  }
4476  goto __pyx_L4_argument_unpacking_done;
4477  __pyx_L5_argtuple_error:;
4478  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 118, __pyx_L3_error)
4479  __pyx_L3_error:;
4480  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4481  __Pyx_RefNannyFinishContext();
4482  return NULL;
4483  __pyx_L4_argument_unpacking_done:;
4484  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 118, __pyx_L1_error)
4485  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 119, __pyx_L1_error)
4486  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) __PYX_ERR(0, 120, __pyx_L1_error)
4487  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 121, __pyx_L1_error)
4488  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
4489 
4490  /* function exit code */
4491  goto __pyx_L0;
4492  __pyx_L1_error:;
4493  __pyx_r = NULL;
4494  __pyx_L0:;
4495  __Pyx_RefNannyFinishContext();
4496  return __pyx_r;
4497 }
4498 
4499 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
4500  int __pyx_v_ebN;
4501  int __pyx_v_material_left;
4502  int __pyx_v_material_right;
4503  npy_intp __pyx_v_k;
4504  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
4505  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
4506  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
4507  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
4508  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
4509  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
4510  PyObject *__pyx_r = NULL;
4511  __Pyx_RefNannyDeclarations
4512  npy_intp __pyx_t_1;
4513  npy_intp __pyx_t_2;
4514  int __pyx_t_3;
4515  Py_ssize_t __pyx_t_4;
4516  Py_ssize_t __pyx_t_5;
4517  int __pyx_t_6;
4518  Py_ssize_t __pyx_t_7;
4519  Py_ssize_t __pyx_t_8;
4520  npy_intp __pyx_t_9;
4521  npy_intp __pyx_t_10;
4522  npy_intp __pyx_t_11;
4523  PyObject *__pyx_t_12 = NULL;
4524  PyObject *__pyx_t_13 = NULL;
4525  PyObject *__pyx_t_14 = NULL;
4526  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_15;
4527  Py_ssize_t __pyx_t_16;
4528  Py_ssize_t __pyx_t_17;
4529  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 0);
4530  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
4531  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
4532  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
4533  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
4534  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
4535  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
4536  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
4537  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
4538  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
4539  __pyx_pybuffer_ebq_global_vals.refcount = 0;
4540  __pyx_pybuffernd_ebq_global_vals.data = NULL;
4541  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
4542  {
4543  __Pyx_BufFmt_StackElem __pyx_stack[1];
4544  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 118, __pyx_L1_error)
4545  }
4546  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
4547  {
4548  __Pyx_BufFmt_StackElem __pyx_stack[1];
4549  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 118, __pyx_L1_error)
4550  }
4551  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
4552  {
4553  __Pyx_BufFmt_StackElem __pyx_stack[1];
4554  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 118, __pyx_L1_error)
4555  }
4556  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1];
4557 
4558  /* "subsurfaceTransportFunctions.pyx":131
4559  * cdef int ebN,material_left,material_right
4560  *
4561  * for ebN in range(ebq_global_vals.shape[0]): # <<<<<<<<<<<<<<
4562  * material_left = elementBoundaryTypes[ebN,0]
4563  * material_right= elementBoundaryTypes[ebN,1]
4564  */
4565  __pyx_t_1 = (__pyx_v_ebq_global_vals->dimensions[0]);
4566  __pyx_t_2 = __pyx_t_1;
4567  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
4568  __pyx_v_ebN = __pyx_t_3;
4569 
4570  /* "subsurfaceTransportFunctions.pyx":132
4571  *
4572  * for ebN in range(ebq_global_vals.shape[0]):
4573  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
4574  * material_right= elementBoundaryTypes[ebN,1]
4575  * for k in range(ebq_global_vals.shape[1]):
4576  */
4577  __pyx_t_4 = __pyx_v_ebN;
4578  __pyx_t_5 = 0;
4579  __pyx_t_6 = -1;
4580  if (__pyx_t_4 < 0) {
4581  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4582  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
4583  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
4584  if (__pyx_t_5 < 0) {
4585  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4586  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
4587  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
4588  if (unlikely(__pyx_t_6 != -1)) {
4589  __Pyx_RaiseBufferIndexError(__pyx_t_6);
4590  __PYX_ERR(0, 132, __pyx_L1_error)
4591  }
4592  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4593 
4594  /* "subsurfaceTransportFunctions.pyx":133
4595  * for ebN in range(ebq_global_vals.shape[0]):
4596  * material_left = elementBoundaryTypes[ebN,0]
4597  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
4598  * for k in range(ebq_global_vals.shape[1]):
4599  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+
4600  */
4601  __pyx_t_7 = __pyx_v_ebN;
4602  __pyx_t_8 = 1;
4603  __pyx_t_6 = -1;
4604  if (__pyx_t_7 < 0) {
4605  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4606  if (unlikely(__pyx_t_7 < 0)) __pyx_t_6 = 0;
4607  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
4608  if (__pyx_t_8 < 0) {
4609  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4610  if (unlikely(__pyx_t_8 < 0)) __pyx_t_6 = 1;
4611  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
4612  if (unlikely(__pyx_t_6 != -1)) {
4613  __Pyx_RaiseBufferIndexError(__pyx_t_6);
4614  __PYX_ERR(0, 133, __pyx_L1_error)
4615  }
4616  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4617 
4618  /* "subsurfaceTransportFunctions.pyx":134
4619  * material_left = elementBoundaryTypes[ebN,0]
4620  * material_right= elementBoundaryTypes[ebN,1]
4621  * for k in range(ebq_global_vals.shape[1]): # <<<<<<<<<<<<<<
4622  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+
4623  * material_functions[material_right])
4624  */
4625  __pyx_t_9 = (__pyx_v_ebq_global_vals->dimensions[1]);
4626  __pyx_t_10 = __pyx_t_9;
4627  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
4628  __pyx_v_k = __pyx_t_11;
4629 
4630  /* "subsurfaceTransportFunctions.pyx":135
4631  * material_right= elementBoundaryTypes[ebN,1]
4632  * for k in range(ebq_global_vals.shape[1]):
4633  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
4634  * material_functions[material_right])
4635  *
4636  */
4637  if (unlikely(__pyx_v_material_functions == Py_None)) {
4638  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4639  __PYX_ERR(0, 135, __pyx_L1_error)
4640  }
4641  __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 135, __pyx_L1_error)
4642  __Pyx_GOTREF(__pyx_t_12);
4643  __pyx_t_13 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 135, __pyx_L1_error)
4644  __Pyx_GOTREF(__pyx_t_13);
4645  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4646 
4647  /* "subsurfaceTransportFunctions.pyx":136
4648  * for k in range(ebq_global_vals.shape[1]):
4649  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+
4650  * material_functions[material_right]) # <<<<<<<<<<<<<<
4651  *
4652  *
4653  */
4654  if (unlikely(__pyx_v_material_functions == Py_None)) {
4655  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4656  __PYX_ERR(0, 136, __pyx_L1_error)
4657  }
4658  __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 136, __pyx_L1_error)
4659  __Pyx_GOTREF(__pyx_t_12);
4660  __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 136, __pyx_L1_error)
4661  __Pyx_GOTREF(__pyx_t_14);
4662  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4663 
4664  /* "subsurfaceTransportFunctions.pyx":135
4665  * material_right= elementBoundaryTypes[ebN,1]
4666  * for k in range(ebq_global_vals.shape[1]):
4667  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
4668  * material_functions[material_right])
4669  *
4670  */
4671  __pyx_t_12 = PyNumber_Add(__pyx_t_13, __pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 135, __pyx_L1_error)
4672  __Pyx_GOTREF(__pyx_t_12);
4673  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
4674  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4675  __pyx_t_14 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 135, __pyx_L1_error)
4676  __Pyx_GOTREF(__pyx_t_14);
4677  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4678  __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_14); if (unlikely((__pyx_t_15 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 135, __pyx_L1_error)
4679  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4680  __pyx_t_16 = __pyx_v_ebN;
4681  __pyx_t_17 = __pyx_v_k;
4682  __pyx_t_6 = -1;
4683  if (__pyx_t_16 < 0) {
4684  __pyx_t_16 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
4685  if (unlikely(__pyx_t_16 < 0)) __pyx_t_6 = 0;
4686  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_6 = 0;
4687  if (__pyx_t_17 < 0) {
4688  __pyx_t_17 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
4689  if (unlikely(__pyx_t_17 < 0)) __pyx_t_6 = 1;
4690  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_6 = 1;
4691  if (unlikely(__pyx_t_6 != -1)) {
4692  __Pyx_RaiseBufferIndexError(__pyx_t_6);
4693  __PYX_ERR(0, 135, __pyx_L1_error)
4694  }
4695  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides) = __pyx_t_15;
4696  }
4697  }
4698 
4699  /* "subsurfaceTransportFunctions.pyx":118
4700  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
4701  *
4702  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
4703  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4704  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
4705  */
4706 
4707  /* function exit code */
4708  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4709  goto __pyx_L0;
4710  __pyx_L1_error:;
4711  __Pyx_XDECREF(__pyx_t_12);
4712  __Pyx_XDECREF(__pyx_t_13);
4713  __Pyx_XDECREF(__pyx_t_14);
4714  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4715  __Pyx_PyThreadState_declare
4716  __Pyx_PyThreadState_assign
4717  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4718  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
4719  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4720  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4721  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4722  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4723  __pyx_r = NULL;
4724  goto __pyx_L2;
4725  __pyx_L0:;
4726  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
4727  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4728  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4729  __pyx_L2:;
4730  __Pyx_XGIVEREF(__pyx_r);
4731  __Pyx_RefNannyFinishContext();
4732  return __pyx_r;
4733 }
4734 
4735 /* "subsurfaceTransportFunctions.pyx":139
4736  *
4737  *
4738  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
4739  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
4740  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4741  */
4742 
4743 /* Python wrapper */
4744 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4745 static char __pyx_doc_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn} = f^L_{j,mn}f^R_{k,mn}/(f^L_{j,mn}+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
4746 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage = {"setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage};
4747 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4748  int __pyx_v_nd;
4749  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
4750  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
4751  PyArrayObject *__pyx_v_ebq_global_vals = 0;
4752  PyObject *__pyx_v_material_functions = 0;
4753  PyObject *__pyx_r = 0;
4754  __Pyx_RefNannyDeclarations
4755  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage (wrapper)", 0);
4756  {
4757  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
4758  PyObject* values[5] = {0,0,0,0,0};
4759  if (unlikely(__pyx_kwds)) {
4760  Py_ssize_t kw_args;
4761  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4762  switch (pos_args) {
4763  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4764  CYTHON_FALLTHROUGH;
4765  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4766  CYTHON_FALLTHROUGH;
4767  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4768  CYTHON_FALLTHROUGH;
4769  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4770  CYTHON_FALLTHROUGH;
4771  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4772  CYTHON_FALLTHROUGH;
4773  case 0: break;
4774  default: goto __pyx_L5_argtuple_error;
4775  }
4776  kw_args = PyDict_Size(__pyx_kwds);
4777  switch (pos_args) {
4778  case 0:
4779  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
4780  else goto __pyx_L5_argtuple_error;
4781  CYTHON_FALLTHROUGH;
4782  case 1:
4783  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
4784  else {
4785  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 1); __PYX_ERR(0, 139, __pyx_L3_error)
4786  }
4787  CYTHON_FALLTHROUGH;
4788  case 2:
4789  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
4790  else {
4791  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 2); __PYX_ERR(0, 139, __pyx_L3_error)
4792  }
4793  CYTHON_FALLTHROUGH;
4794  case 3:
4795  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
4796  else {
4797  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 3); __PYX_ERR(0, 139, __pyx_L3_error)
4798  }
4799  CYTHON_FALLTHROUGH;
4800  case 4:
4801  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
4802  else {
4803  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 4); __PYX_ERR(0, 139, __pyx_L3_error)
4804  }
4805  }
4806  if (unlikely(kw_args > 0)) {
4807  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage") < 0)) __PYX_ERR(0, 139, __pyx_L3_error)
4808  }
4809  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
4810  goto __pyx_L5_argtuple_error;
4811  } else {
4812  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4813  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4814  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4815  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4816  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4817  }
4818  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L3_error)
4819  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
4820  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
4821  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[3]);
4822  __pyx_v_material_functions = ((PyObject*)values[4]);
4823  }
4824  goto __pyx_L4_argument_unpacking_done;
4825  __pyx_L5_argtuple_error:;
4826  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 139, __pyx_L3_error)
4827  __pyx_L3_error:;
4828  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4829  __Pyx_RefNannyFinishContext();
4830  return NULL;
4831  __pyx_L4_argument_unpacking_done:;
4832  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 140, __pyx_L1_error)
4833  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 141, __pyx_L1_error)
4834  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) __PYX_ERR(0, 142, __pyx_L1_error)
4835  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 143, __pyx_L1_error)
4836  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
4837 
4838  /* function exit code */
4839  goto __pyx_L0;
4840  __pyx_L1_error:;
4841  __pyx_r = NULL;
4842  __pyx_L0:;
4843  __Pyx_RefNannyFinishContext();
4844  return __pyx_r;
4845 }
4846 
4847 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
4848  int __pyx_v_ebN;
4849  int __pyx_v_k;
4850  int __pyx_v_material_left;
4851  int __pyx_v_material_right;
4852  int __pyx_v_I;
4853  int __pyx_v_J;
4854  double __pyx_v_numer;
4855  double __pyx_v_denom;
4856  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
4857  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
4858  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
4859  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
4860  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
4861  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
4862  PyObject *__pyx_r = NULL;
4863  __Pyx_RefNannyDeclarations
4864  npy_intp __pyx_t_1;
4865  npy_intp __pyx_t_2;
4866  int __pyx_t_3;
4867  Py_ssize_t __pyx_t_4;
4868  Py_ssize_t __pyx_t_5;
4869  int __pyx_t_6;
4870  Py_ssize_t __pyx_t_7;
4871  Py_ssize_t __pyx_t_8;
4872  npy_intp __pyx_t_9;
4873  npy_intp __pyx_t_10;
4874  int __pyx_t_11;
4875  int __pyx_t_12;
4876  int __pyx_t_13;
4877  int __pyx_t_14;
4878  int __pyx_t_15;
4879  int __pyx_t_16;
4880  PyObject *__pyx_t_17 = NULL;
4881  PyObject *__pyx_t_18 = NULL;
4882  PyObject *__pyx_t_19 = NULL;
4883  PyObject *__pyx_t_20 = NULL;
4884  PyObject *__pyx_t_21 = NULL;
4885  double __pyx_t_22;
4886  Py_ssize_t __pyx_t_23;
4887  Py_ssize_t __pyx_t_24;
4888  Py_ssize_t __pyx_t_25;
4889  int __pyx_t_26;
4890  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 0);
4891  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
4892  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
4893  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
4894  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
4895  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
4896  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
4897  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
4898  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
4899  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
4900  __pyx_pybuffer_ebq_global_vals.refcount = 0;
4901  __pyx_pybuffernd_ebq_global_vals.data = NULL;
4902  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
4903  {
4904  __Pyx_BufFmt_StackElem __pyx_stack[1];
4905  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 139, __pyx_L1_error)
4906  }
4907  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
4908  {
4909  __Pyx_BufFmt_StackElem __pyx_stack[1];
4910  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 139, __pyx_L1_error)
4911  }
4912  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
4913  {
4914  __Pyx_BufFmt_StackElem __pyx_stack[1];
4915  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 139, __pyx_L1_error)
4916  }
4917  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[2];
4918 
4919  /* "subsurfaceTransportFunctions.pyx":154
4920  * cdef double numer,denom
4921  *
4922  * for ebN in range(ebq_global_vals.shape[0]): # <<<<<<<<<<<<<<
4923  * material_left = elementBoundaryTypes[ebN,0]
4924  * material_right= elementBoundaryTypes[ebN,1]
4925  */
4926  __pyx_t_1 = (__pyx_v_ebq_global_vals->dimensions[0]);
4927  __pyx_t_2 = __pyx_t_1;
4928  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
4929  __pyx_v_ebN = __pyx_t_3;
4930 
4931  /* "subsurfaceTransportFunctions.pyx":155
4932  *
4933  * for ebN in range(ebq_global_vals.shape[0]):
4934  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
4935  * material_right= elementBoundaryTypes[ebN,1]
4936  * for k in range(ebq_global_vals.shape[1]):
4937  */
4938  __pyx_t_4 = __pyx_v_ebN;
4939  __pyx_t_5 = 0;
4940  __pyx_t_6 = -1;
4941  if (__pyx_t_4 < 0) {
4942  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4943  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
4944  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
4945  if (__pyx_t_5 < 0) {
4946  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4947  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
4948  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
4949  if (unlikely(__pyx_t_6 != -1)) {
4950  __Pyx_RaiseBufferIndexError(__pyx_t_6);
4951  __PYX_ERR(0, 155, __pyx_L1_error)
4952  }
4953  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4954 
4955  /* "subsurfaceTransportFunctions.pyx":156
4956  * for ebN in range(ebq_global_vals.shape[0]):
4957  * material_left = elementBoundaryTypes[ebN,0]
4958  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
4959  * for k in range(ebq_global_vals.shape[1]):
4960  * for I in range(nd):
4961  */
4962  __pyx_t_7 = __pyx_v_ebN;
4963  __pyx_t_8 = 1;
4964  __pyx_t_6 = -1;
4965  if (__pyx_t_7 < 0) {
4966  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4967  if (unlikely(__pyx_t_7 < 0)) __pyx_t_6 = 0;
4968  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
4969  if (__pyx_t_8 < 0) {
4970  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4971  if (unlikely(__pyx_t_8 < 0)) __pyx_t_6 = 1;
4972  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
4973  if (unlikely(__pyx_t_6 != -1)) {
4974  __Pyx_RaiseBufferIndexError(__pyx_t_6);
4975  __PYX_ERR(0, 156, __pyx_L1_error)
4976  }
4977  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4978 
4979  /* "subsurfaceTransportFunctions.pyx":157
4980  * material_left = elementBoundaryTypes[ebN,0]
4981  * material_right= elementBoundaryTypes[ebN,1]
4982  * for k in range(ebq_global_vals.shape[1]): # <<<<<<<<<<<<<<
4983  * for I in range(nd):
4984  * for J in range(nd):
4985  */
4986  __pyx_t_9 = (__pyx_v_ebq_global_vals->dimensions[1]);
4987  __pyx_t_10 = __pyx_t_9;
4988  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_10; __pyx_t_6+=1) {
4989  __pyx_v_k = __pyx_t_6;
4990 
4991  /* "subsurfaceTransportFunctions.pyx":158
4992  * material_right= elementBoundaryTypes[ebN,1]
4993  * for k in range(ebq_global_vals.shape[1]):
4994  * for I in range(nd): # <<<<<<<<<<<<<<
4995  * for J in range(nd):
4996  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4997  */
4998  __pyx_t_11 = __pyx_v_nd;
4999  __pyx_t_12 = __pyx_t_11;
5000  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
5001  __pyx_v_I = __pyx_t_13;
5002 
5003  /* "subsurfaceTransportFunctions.pyx":159
5004  * for k in range(ebq_global_vals.shape[1]):
5005  * for I in range(nd):
5006  * for J in range(nd): # <<<<<<<<<<<<<<
5007  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
5008  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
5009  */
5010  __pyx_t_14 = __pyx_v_nd;
5011  __pyx_t_15 = __pyx_t_14;
5012  for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
5013  __pyx_v_J = __pyx_t_16;
5014 
5015  /* "subsurfaceTransportFunctions.pyx":160
5016  * for I in range(nd):
5017  * for J in range(nd):
5018  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J] # <<<<<<<<<<<<<<
5019  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
5020  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
5021  */
5022  if (unlikely(__pyx_v_material_functions == Py_None)) {
5023  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5024  __PYX_ERR(0, 160, __pyx_L1_error)
5025  }
5026  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 160, __pyx_L1_error)
5027  __Pyx_GOTREF(__pyx_t_17);
5028  __pyx_t_18 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_17); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 160, __pyx_L1_error)
5029  __Pyx_GOTREF(__pyx_t_18);
5030  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
5031  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 160, __pyx_L1_error)
5032  __Pyx_GOTREF(__pyx_t_17);
5033  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 160, __pyx_L1_error)
5034  __Pyx_GOTREF(__pyx_t_19);
5035  __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 160, __pyx_L1_error)
5036  __Pyx_GOTREF(__pyx_t_20);
5037  __Pyx_GIVEREF(__pyx_t_17);
5038  PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_17);
5039  __Pyx_GIVEREF(__pyx_t_19);
5040  PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_19);
5041  __pyx_t_17 = 0;
5042  __pyx_t_19 = 0;
5043  __pyx_t_19 = __Pyx_PyObject_GetItem(__pyx_t_18, __pyx_t_20); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 160, __pyx_L1_error)
5044  __Pyx_GOTREF(__pyx_t_19);
5045  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
5046  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
5047  __pyx_t_20 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_19); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 160, __pyx_L1_error)
5048  __Pyx_GOTREF(__pyx_t_20);
5049  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
5050  if (unlikely(__pyx_v_material_functions == Py_None)) {
5051  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5052  __PYX_ERR(0, 160, __pyx_L1_error)
5053  }
5054  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 160, __pyx_L1_error)
5055  __Pyx_GOTREF(__pyx_t_19);
5056  __pyx_t_18 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_19); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 160, __pyx_L1_error)
5057  __Pyx_GOTREF(__pyx_t_18);
5058  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
5059  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 160, __pyx_L1_error)
5060  __Pyx_GOTREF(__pyx_t_19);
5061  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 160, __pyx_L1_error)
5062  __Pyx_GOTREF(__pyx_t_17);
5063  __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 160, __pyx_L1_error)
5064  __Pyx_GOTREF(__pyx_t_21);
5065  __Pyx_GIVEREF(__pyx_t_19);
5066  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_19);
5067  __Pyx_GIVEREF(__pyx_t_17);
5068  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_17);
5069  __pyx_t_19 = 0;
5070  __pyx_t_17 = 0;
5071  __pyx_t_17 = __Pyx_PyObject_GetItem(__pyx_t_18, __pyx_t_21); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 160, __pyx_L1_error)
5072  __Pyx_GOTREF(__pyx_t_17);
5073  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
5074  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
5075  __pyx_t_21 = PyNumber_Multiply(__pyx_t_20, __pyx_t_17); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 160, __pyx_L1_error)
5076  __Pyx_GOTREF(__pyx_t_21);
5077  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
5078  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
5079  __pyx_t_22 = __pyx_PyFloat_AsDouble(__pyx_t_21); if (unlikely((__pyx_t_22 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 160, __pyx_L1_error)
5080  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
5081  __pyx_v_numer = __pyx_t_22;
5082 
5083  /* "subsurfaceTransportFunctions.pyx":161
5084  * for J in range(nd):
5085  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
5086  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20 # <<<<<<<<<<<<<<
5087  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
5088  *
5089  */
5090  if (unlikely(__pyx_v_material_functions == Py_None)) {
5091  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5092  __PYX_ERR(0, 161, __pyx_L1_error)
5093  }
5094  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 161, __pyx_L1_error)
5095  __Pyx_GOTREF(__pyx_t_21);
5096  __pyx_t_17 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_21); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 161, __pyx_L1_error)
5097  __Pyx_GOTREF(__pyx_t_17);
5098  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
5099  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 161, __pyx_L1_error)
5100  __Pyx_GOTREF(__pyx_t_21);
5101  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 161, __pyx_L1_error)
5102  __Pyx_GOTREF(__pyx_t_20);
5103  __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 161, __pyx_L1_error)
5104  __Pyx_GOTREF(__pyx_t_18);
5105  __Pyx_GIVEREF(__pyx_t_21);
5106  PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_21);
5107  __Pyx_GIVEREF(__pyx_t_20);
5108  PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_20);
5109  __pyx_t_21 = 0;
5110  __pyx_t_20 = 0;
5111  __pyx_t_20 = __Pyx_PyObject_GetItem(__pyx_t_17, __pyx_t_18); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 161, __pyx_L1_error)
5112  __Pyx_GOTREF(__pyx_t_20);
5113  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
5114  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
5115  if (unlikely(__pyx_v_material_functions == Py_None)) {
5116  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5117  __PYX_ERR(0, 161, __pyx_L1_error)
5118  }
5119  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 161, __pyx_L1_error)
5120  __Pyx_GOTREF(__pyx_t_18);
5121  __pyx_t_17 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_18); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 161, __pyx_L1_error)
5122  __Pyx_GOTREF(__pyx_t_17);
5123  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
5124  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 161, __pyx_L1_error)
5125  __Pyx_GOTREF(__pyx_t_18);
5126  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 161, __pyx_L1_error)
5127  __Pyx_GOTREF(__pyx_t_21);
5128  __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 161, __pyx_L1_error)
5129  __Pyx_GOTREF(__pyx_t_19);
5130  __Pyx_GIVEREF(__pyx_t_18);
5131  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_18);
5132  __Pyx_GIVEREF(__pyx_t_21);
5133  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_21);
5134  __pyx_t_18 = 0;
5135  __pyx_t_21 = 0;
5136  __pyx_t_21 = __Pyx_PyObject_GetItem(__pyx_t_17, __pyx_t_19); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 161, __pyx_L1_error)
5137  __Pyx_GOTREF(__pyx_t_21);
5138  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
5139  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
5140  __pyx_t_19 = PyNumber_Add(__pyx_t_20, __pyx_t_21); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 161, __pyx_L1_error)
5141  __Pyx_GOTREF(__pyx_t_19);
5142  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
5143  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
5144  __pyx_t_21 = __Pyx_PyFloat_AddObjC(__pyx_t_19, __pyx_float_1_0eneg_20, 1.0e-20, 0, 0); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 161, __pyx_L1_error)
5145  __Pyx_GOTREF(__pyx_t_21);
5146  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
5147  __pyx_t_22 = __pyx_PyFloat_AsDouble(__pyx_t_21); if (unlikely((__pyx_t_22 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 161, __pyx_L1_error)
5148  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
5149  __pyx_v_denom = __pyx_t_22;
5150 
5151  /* "subsurfaceTransportFunctions.pyx":162
5152  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
5153  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
5154  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
5155  *
5156  * ###
5157  */
5158  if (unlikely(__pyx_v_denom == 0)) {
5159  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
5160  __PYX_ERR(0, 162, __pyx_L1_error)
5161  }
5162  __pyx_t_23 = __pyx_v_ebN;
5163  __pyx_t_24 = __pyx_v_k;
5164  __pyx_t_25 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
5165  __pyx_t_26 = -1;
5166  if (__pyx_t_23 < 0) {
5167  __pyx_t_23 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
5168  if (unlikely(__pyx_t_23 < 0)) __pyx_t_26 = 0;
5169  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_26 = 0;
5170  if (__pyx_t_24 < 0) {
5171  __pyx_t_24 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
5172  if (unlikely(__pyx_t_24 < 0)) __pyx_t_26 = 1;
5173  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_26 = 1;
5174  if (__pyx_t_25 < 0) {
5175  __pyx_t_25 += __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape;
5176  if (unlikely(__pyx_t_25 < 0)) __pyx_t_26 = 2;
5177  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape)) __pyx_t_26 = 2;
5178  if (unlikely(__pyx_t_26 != -1)) {
5179  __Pyx_RaiseBufferIndexError(__pyx_t_26);
5180  __PYX_ERR(0, 162, __pyx_L1_error)
5181  }
5182  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides, __pyx_t_25, __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides) = (__pyx_v_numer / __pyx_v_denom);
5183  }
5184  }
5185  }
5186  }
5187 
5188  /* "subsurfaceTransportFunctions.pyx":139
5189  *
5190  *
5191  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
5192  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
5193  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
5194  */
5195 
5196  /* function exit code */
5197  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5198  goto __pyx_L0;
5199  __pyx_L1_error:;
5200  __Pyx_XDECREF(__pyx_t_17);
5201  __Pyx_XDECREF(__pyx_t_18);
5202  __Pyx_XDECREF(__pyx_t_19);
5203  __Pyx_XDECREF(__pyx_t_20);
5204  __Pyx_XDECREF(__pyx_t_21);
5205  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5206  __Pyx_PyThreadState_declare
5207  __Pyx_PyThreadState_assign
5208  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5209  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
5210  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
5211  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
5212  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5213  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
5214  __pyx_r = NULL;
5215  goto __pyx_L2;
5216  __pyx_L0:;
5217  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
5218  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
5219  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
5220  __pyx_L2:;
5221  __Pyx_XGIVEREF(__pyx_r);
5222  __Pyx_RefNannyFinishContext();
5223  return __pyx_r;
5224 }
5225 
5226 /* "subsurfaceTransportFunctions.pyx":165
5227  *
5228  * ###
5229  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
5230  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
5231  * numpy.ndarray[DTYPE_t,ndim=3] x,
5232  */
5233 
5234 /* Python wrapper */
5235 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5236 static char __pyx_doc_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements[] = "\n loop over quadrature array and evaluate function f_j(x,t) assuming element is material j\n likely little improvement right now without correct typing of material_functions\n ";
5237 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements = {"evaluateScalarMaterialFunctionOverElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements};
5238 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5239  double __pyx_v_t;
5240  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
5241  PyArrayObject *__pyx_v_x = 0;
5242  PyArrayObject *__pyx_v_q_vals = 0;
5243  PyObject *__pyx_v_material_functions = 0;
5244  PyObject *__pyx_r = 0;
5245  __Pyx_RefNannyDeclarations
5246  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElements (wrapper)", 0);
5247  {
5248  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_x,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
5249  PyObject* values[5] = {0,0,0,0,0};
5250  if (unlikely(__pyx_kwds)) {
5251  Py_ssize_t kw_args;
5252  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5253  switch (pos_args) {
5254  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5255  CYTHON_FALLTHROUGH;
5256  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5257  CYTHON_FALLTHROUGH;
5258  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5259  CYTHON_FALLTHROUGH;
5260  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5261  CYTHON_FALLTHROUGH;
5262  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5263  CYTHON_FALLTHROUGH;
5264  case 0: break;
5265  default: goto __pyx_L5_argtuple_error;
5266  }
5267  kw_args = PyDict_Size(__pyx_kwds);
5268  switch (pos_args) {
5269  case 0:
5270  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
5271  else goto __pyx_L5_argtuple_error;
5272  CYTHON_FALLTHROUGH;
5273  case 1:
5274  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
5275  else {
5276  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 1); __PYX_ERR(0, 165, __pyx_L3_error)
5277  }
5278  CYTHON_FALLTHROUGH;
5279  case 2:
5280  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
5281  else {
5282  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 2); __PYX_ERR(0, 165, __pyx_L3_error)
5283  }
5284  CYTHON_FALLTHROUGH;
5285  case 3:
5286  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
5287  else {
5288  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 3); __PYX_ERR(0, 165, __pyx_L3_error)
5289  }
5290  CYTHON_FALLTHROUGH;
5291  case 4:
5292  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
5293  else {
5294  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 4); __PYX_ERR(0, 165, __pyx_L3_error)
5295  }
5296  }
5297  if (unlikely(kw_args > 0)) {
5298  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateScalarMaterialFunctionOverElements") < 0)) __PYX_ERR(0, 165, __pyx_L3_error)
5299  }
5300  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
5301  goto __pyx_L5_argtuple_error;
5302  } else {
5303  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5304  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5305  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5306  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5307  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5308  }
5309  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 165, __pyx_L3_error)
5310  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[1]);
5311  __pyx_v_x = ((PyArrayObject *)values[2]);
5312  __pyx_v_q_vals = ((PyArrayObject *)values[3]);
5313  __pyx_v_material_functions = ((PyObject*)values[4]);
5314  }
5315  goto __pyx_L4_argument_unpacking_done;
5316  __pyx_L5_argtuple_error:;
5317  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 165, __pyx_L3_error)
5318  __pyx_L3_error:;
5319  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
5320  __Pyx_RefNannyFinishContext();
5321  return NULL;
5322  __pyx_L4_argument_unpacking_done:;
5323  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 166, __pyx_L1_error)
5324  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 167, __pyx_L1_error)
5325  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) __PYX_ERR(0, 168, __pyx_L1_error)
5326  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 169, __pyx_L1_error)
5327  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements(__pyx_self, __pyx_v_t, __pyx_v_elementMaterialTypes, __pyx_v_x, __pyx_v_q_vals, __pyx_v_material_functions);
5328 
5329  /* function exit code */
5330  goto __pyx_L0;
5331  __pyx_L1_error:;
5332  __pyx_r = NULL;
5333  __pyx_L0:;
5334  __Pyx_RefNannyFinishContext();
5335  return __pyx_r;
5336 }
5337 
5338 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
5339  int __pyx_v_eN;
5340  int __pyx_v_k;
5341  int __pyx_v_material;
5342  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
5343  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
5344  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
5345  __Pyx_Buffer __pyx_pybuffer_q_vals;
5346  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
5347  __Pyx_Buffer __pyx_pybuffer_x;
5348  PyObject *__pyx_r = NULL;
5349  __Pyx_RefNannyDeclarations
5350  npy_intp __pyx_t_1;
5351  npy_intp __pyx_t_2;
5352  int __pyx_t_3;
5353  Py_ssize_t __pyx_t_4;
5354  int __pyx_t_5;
5355  npy_intp __pyx_t_6;
5356  npy_intp __pyx_t_7;
5357  PyObject *__pyx_t_8 = NULL;
5358  PyObject *__pyx_t_9 = NULL;
5359  PyObject *__pyx_t_10 = NULL;
5360  PyObject *__pyx_t_11 = NULL;
5361  PyObject *__pyx_t_12 = NULL;
5362  int __pyx_t_13;
5363  PyObject *__pyx_t_14 = NULL;
5364  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_15;
5365  Py_ssize_t __pyx_t_16;
5366  Py_ssize_t __pyx_t_17;
5367  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElements", 0);
5368  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
5369  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
5370  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
5371  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
5372  __pyx_pybuffer_x.pybuffer.buf = NULL;
5373  __pyx_pybuffer_x.refcount = 0;
5374  __pyx_pybuffernd_x.data = NULL;
5375  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
5376  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
5377  __pyx_pybuffer_q_vals.refcount = 0;
5378  __pyx_pybuffernd_q_vals.data = NULL;
5379  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
5380  {
5381  __Pyx_BufFmt_StackElem __pyx_stack[1];
5382  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 165, __pyx_L1_error)
5383  }
5384  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
5385  {
5386  __Pyx_BufFmt_StackElem __pyx_stack[1];
5387  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 165, __pyx_L1_error)
5388  }
5389  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
5390  {
5391  __Pyx_BufFmt_StackElem __pyx_stack[1];
5392  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 165, __pyx_L1_error)
5393  }
5394  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1];
5395 
5396  /* "subsurfaceTransportFunctions.pyx":175
5397  * """
5398  * cdef int eN,k,material
5399  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
5400  * material = elementMaterialTypes[eN]
5401  * for k in range(x.shape[1]):
5402  */
5403  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
5404  __pyx_t_2 = __pyx_t_1;
5405  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
5406  __pyx_v_eN = __pyx_t_3;
5407 
5408  /* "subsurfaceTransportFunctions.pyx":176
5409  * cdef int eN,k,material
5410  * for eN in range(x.shape[0]):
5411  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
5412  * for k in range(x.shape[1]):
5413  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
5414  */
5415  __pyx_t_4 = __pyx_v_eN;
5416  __pyx_t_5 = -1;
5417  if (__pyx_t_4 < 0) {
5418  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
5419  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
5420  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
5421  if (unlikely(__pyx_t_5 != -1)) {
5422  __Pyx_RaiseBufferIndexError(__pyx_t_5);
5423  __PYX_ERR(0, 176, __pyx_L1_error)
5424  }
5425  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
5426 
5427  /* "subsurfaceTransportFunctions.pyx":177
5428  * for eN in range(x.shape[0]):
5429  * material = elementMaterialTypes[eN]
5430  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
5431  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
5432  *
5433  */
5434  __pyx_t_6 = (__pyx_v_x->dimensions[1]);
5435  __pyx_t_7 = __pyx_t_6;
5436  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_7; __pyx_t_5+=1) {
5437  __pyx_v_k = __pyx_t_5;
5438 
5439  /* "subsurfaceTransportFunctions.pyx":178
5440  * material = elementMaterialTypes[eN]
5441  * for k in range(x.shape[1]):
5442  * q_vals[eN,k] = material_functions[material](x[eN,k],t) # <<<<<<<<<<<<<<
5443  *
5444  * def evaluateVectorMaterialFunctionOverElements(double t,
5445  */
5446  if (unlikely(__pyx_v_material_functions == Py_None)) {
5447  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5448  __PYX_ERR(0, 178, __pyx_L1_error)
5449  }
5450  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 178, __pyx_L1_error)
5451  __Pyx_GOTREF(__pyx_t_9);
5452  __pyx_t_10 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 178, __pyx_L1_error)
5453  __Pyx_GOTREF(__pyx_t_10);
5454  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5455  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 178, __pyx_L1_error)
5456  __Pyx_GOTREF(__pyx_t_9);
5457  __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 178, __pyx_L1_error)
5458  __Pyx_GOTREF(__pyx_t_11);
5459  __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 178, __pyx_L1_error)
5460  __Pyx_GOTREF(__pyx_t_12);
5461  __Pyx_GIVEREF(__pyx_t_9);
5462  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9);
5463  __Pyx_GIVEREF(__pyx_t_11);
5464  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11);
5465  __pyx_t_9 = 0;
5466  __pyx_t_11 = 0;
5467  __pyx_t_11 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 178, __pyx_L1_error)
5468  __Pyx_GOTREF(__pyx_t_11);
5469  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5470  __pyx_t_12 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 178, __pyx_L1_error)
5471  __Pyx_GOTREF(__pyx_t_12);
5472  __pyx_t_9 = NULL;
5473  __pyx_t_13 = 0;
5474  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
5475  __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
5476  if (likely(__pyx_t_9)) {
5477  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
5478  __Pyx_INCREF(__pyx_t_9);
5479  __Pyx_INCREF(function);
5480  __Pyx_DECREF_SET(__pyx_t_10, function);
5481  __pyx_t_13 = 1;
5482  }
5483  }
5484  #if CYTHON_FAST_PYCALL
5485  if (PyFunction_Check(__pyx_t_10)) {
5486  PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_11, __pyx_t_12};
5487  __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 178, __pyx_L1_error)
5488  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5489  __Pyx_GOTREF(__pyx_t_8);
5490  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5491  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5492  } else
5493  #endif
5494  #if CYTHON_FAST_PYCCALL
5495  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
5496  PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_11, __pyx_t_12};
5497  __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 178, __pyx_L1_error)
5498  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5499  __Pyx_GOTREF(__pyx_t_8);
5500  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5501  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5502  } else
5503  #endif
5504  {
5505  __pyx_t_14 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 178, __pyx_L1_error)
5506  __Pyx_GOTREF(__pyx_t_14);
5507  if (__pyx_t_9) {
5508  __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_9); __pyx_t_9 = NULL;
5509  }
5510  __Pyx_GIVEREF(__pyx_t_11);
5511  PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_13, __pyx_t_11);
5512  __Pyx_GIVEREF(__pyx_t_12);
5513  PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_13, __pyx_t_12);
5514  __pyx_t_11 = 0;
5515  __pyx_t_12 = 0;
5516  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 178, __pyx_L1_error)
5517  __Pyx_GOTREF(__pyx_t_8);
5518  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
5519  }
5520  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5521  __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_15 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L1_error)
5522  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5523  __pyx_t_16 = __pyx_v_eN;
5524  __pyx_t_17 = __pyx_v_k;
5525  __pyx_t_13 = -1;
5526  if (__pyx_t_16 < 0) {
5527  __pyx_t_16 += __pyx_pybuffernd_q_vals.diminfo[0].shape;
5528  if (unlikely(__pyx_t_16 < 0)) __pyx_t_13 = 0;
5529  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_q_vals.diminfo[0].shape)) __pyx_t_13 = 0;
5530  if (__pyx_t_17 < 0) {
5531  __pyx_t_17 += __pyx_pybuffernd_q_vals.diminfo[1].shape;
5532  if (unlikely(__pyx_t_17 < 0)) __pyx_t_13 = 1;
5533  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_q_vals.diminfo[1].shape)) __pyx_t_13 = 1;
5534  if (unlikely(__pyx_t_13 != -1)) {
5535  __Pyx_RaiseBufferIndexError(__pyx_t_13);
5536  __PYX_ERR(0, 178, __pyx_L1_error)
5537  }
5538  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_q_vals.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_q_vals.diminfo[1].strides) = __pyx_t_15;
5539  }
5540  }
5541 
5542  /* "subsurfaceTransportFunctions.pyx":165
5543  *
5544  * ###
5545  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
5546  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
5547  * numpy.ndarray[DTYPE_t,ndim=3] x,
5548  */
5549 
5550  /* function exit code */
5551  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5552  goto __pyx_L0;
5553  __pyx_L1_error:;
5554  __Pyx_XDECREF(__pyx_t_8);
5555  __Pyx_XDECREF(__pyx_t_9);
5556  __Pyx_XDECREF(__pyx_t_10);
5557  __Pyx_XDECREF(__pyx_t_11);
5558  __Pyx_XDECREF(__pyx_t_12);
5559  __Pyx_XDECREF(__pyx_t_14);
5560  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5561  __Pyx_PyThreadState_declare
5562  __Pyx_PyThreadState_assign
5563  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5564  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
5565  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
5566  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5567  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5568  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
5569  __pyx_r = NULL;
5570  goto __pyx_L2;
5571  __pyx_L0:;
5572  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
5573  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
5574  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5575  __pyx_L2:;
5576  __Pyx_XGIVEREF(__pyx_r);
5577  __Pyx_RefNannyFinishContext();
5578  return __pyx_r;
5579 }
5580 
5581 /* "subsurfaceTransportFunctions.pyx":180
5582  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
5583  *
5584  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
5585  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
5586  * numpy.ndarray[DTYPE_t,ndim=3] x,
5587  */
5588 
5589 /* Python wrapper */
5590 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5591 static char __pyx_doc_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements[] = "\n loop over quadrature array and evaluate function \013ec f_j(x,t) assuming element is material j\n ";
5592 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements = {"evaluateVectorMaterialFunctionOverElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements};
5593 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5594  double __pyx_v_t;
5595  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
5596  PyArrayObject *__pyx_v_x = 0;
5597  PyArrayObject *__pyx_v_q_vals = 0;
5598  PyObject *__pyx_v_material_functions = 0;
5599  PyObject *__pyx_r = 0;
5600  __Pyx_RefNannyDeclarations
5601  __Pyx_RefNannySetupContext("evaluateVectorMaterialFunctionOverElements (wrapper)", 0);
5602  {
5603  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_x,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
5604  PyObject* values[5] = {0,0,0,0,0};
5605  if (unlikely(__pyx_kwds)) {
5606  Py_ssize_t kw_args;
5607  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5608  switch (pos_args) {
5609  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5610  CYTHON_FALLTHROUGH;
5611  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5612  CYTHON_FALLTHROUGH;
5613  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5614  CYTHON_FALLTHROUGH;
5615  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5616  CYTHON_FALLTHROUGH;
5617  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5618  CYTHON_FALLTHROUGH;
5619  case 0: break;
5620  default: goto __pyx_L5_argtuple_error;
5621  }
5622  kw_args = PyDict_Size(__pyx_kwds);
5623  switch (pos_args) {
5624  case 0:
5625  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
5626  else goto __pyx_L5_argtuple_error;
5627  CYTHON_FALLTHROUGH;
5628  case 1:
5629  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
5630  else {
5631  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 1); __PYX_ERR(0, 180, __pyx_L3_error)
5632  }
5633  CYTHON_FALLTHROUGH;
5634  case 2:
5635  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
5636  else {
5637  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 2); __PYX_ERR(0, 180, __pyx_L3_error)
5638  }
5639  CYTHON_FALLTHROUGH;
5640  case 3:
5641  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
5642  else {
5643  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 3); __PYX_ERR(0, 180, __pyx_L3_error)
5644  }
5645  CYTHON_FALLTHROUGH;
5646  case 4:
5647  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
5648  else {
5649  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 4); __PYX_ERR(0, 180, __pyx_L3_error)
5650  }
5651  }
5652  if (unlikely(kw_args > 0)) {
5653  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateVectorMaterialFunctionOverElements") < 0)) __PYX_ERR(0, 180, __pyx_L3_error)
5654  }
5655  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
5656  goto __pyx_L5_argtuple_error;
5657  } else {
5658  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5659  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5660  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5661  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5662  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5663  }
5664  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L3_error)
5665  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[1]);
5666  __pyx_v_x = ((PyArrayObject *)values[2]);
5667  __pyx_v_q_vals = ((PyArrayObject *)values[3]);
5668  __pyx_v_material_functions = ((PyObject*)values[4]);
5669  }
5670  goto __pyx_L4_argument_unpacking_done;
5671  __pyx_L5_argtuple_error:;
5672  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 180, __pyx_L3_error)
5673  __pyx_L3_error:;
5674  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
5675  __Pyx_RefNannyFinishContext();
5676  return NULL;
5677  __pyx_L4_argument_unpacking_done:;
5678  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 181, __pyx_L1_error)
5679  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 182, __pyx_L1_error)
5680  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) __PYX_ERR(0, 183, __pyx_L1_error)
5681  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 184, __pyx_L1_error)
5682  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements(__pyx_self, __pyx_v_t, __pyx_v_elementMaterialTypes, __pyx_v_x, __pyx_v_q_vals, __pyx_v_material_functions);
5683 
5684  /* function exit code */
5685  goto __pyx_L0;
5686  __pyx_L1_error:;
5687  __pyx_r = NULL;
5688  __pyx_L0:;
5689  __Pyx_RefNannyFinishContext();
5690  return __pyx_r;
5691 }
5692 
5693 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
5694  int __pyx_v_eN;
5695  int __pyx_v_k;
5696  int __pyx_v_material;
5697  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
5698  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
5699  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
5700  __Pyx_Buffer __pyx_pybuffer_q_vals;
5701  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
5702  __Pyx_Buffer __pyx_pybuffer_x;
5703  PyObject *__pyx_r = NULL;
5704  __Pyx_RefNannyDeclarations
5705  npy_intp __pyx_t_1;
5706  npy_intp __pyx_t_2;
5707  int __pyx_t_3;
5708  Py_ssize_t __pyx_t_4;
5709  int __pyx_t_5;
5710  npy_intp __pyx_t_6;
5711  npy_intp __pyx_t_7;
5712  PyObject *__pyx_t_8 = NULL;
5713  PyObject *__pyx_t_9 = NULL;
5714  PyObject *__pyx_t_10 = NULL;
5715  PyObject *__pyx_t_11 = NULL;
5716  PyObject *__pyx_t_12 = NULL;
5717  int __pyx_t_13;
5718  PyObject *__pyx_t_14 = NULL;
5719  __Pyx_RefNannySetupContext("evaluateVectorMaterialFunctionOverElements", 0);
5720  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
5721  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
5722  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
5723  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
5724  __pyx_pybuffer_x.pybuffer.buf = NULL;
5725  __pyx_pybuffer_x.refcount = 0;
5726  __pyx_pybuffernd_x.data = NULL;
5727  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
5728  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
5729  __pyx_pybuffer_q_vals.refcount = 0;
5730  __pyx_pybuffernd_q_vals.data = NULL;
5731  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
5732  {
5733  __Pyx_BufFmt_StackElem __pyx_stack[1];
5734  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 180, __pyx_L1_error)
5735  }
5736  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
5737  {
5738  __Pyx_BufFmt_StackElem __pyx_stack[1];
5739  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 180, __pyx_L1_error)
5740  }
5741  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
5742  {
5743  __Pyx_BufFmt_StackElem __pyx_stack[1];
5744  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 180, __pyx_L1_error)
5745  }
5746  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_vals.diminfo[2].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_vals.diminfo[2].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[2];
5747 
5748  /* "subsurfaceTransportFunctions.pyx":189
5749  * """
5750  * cdef int eN,k,material
5751  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
5752  * material = elementMaterialTypes[eN]
5753  * for k in range(x.shape[1]):
5754  */
5755  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
5756  __pyx_t_2 = __pyx_t_1;
5757  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
5758  __pyx_v_eN = __pyx_t_3;
5759 
5760  /* "subsurfaceTransportFunctions.pyx":190
5761  * cdef int eN,k,material
5762  * for eN in range(x.shape[0]):
5763  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
5764  * for k in range(x.shape[1]):
5765  * q_vals[eN,k,:] = material_functions[material](x[eN,k],t).flat
5766  */
5767  __pyx_t_4 = __pyx_v_eN;
5768  __pyx_t_5 = -1;
5769  if (__pyx_t_4 < 0) {
5770  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
5771  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
5772  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
5773  if (unlikely(__pyx_t_5 != -1)) {
5774  __Pyx_RaiseBufferIndexError(__pyx_t_5);
5775  __PYX_ERR(0, 190, __pyx_L1_error)
5776  }
5777  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
5778 
5779  /* "subsurfaceTransportFunctions.pyx":191
5780  * for eN in range(x.shape[0]):
5781  * material = elementMaterialTypes[eN]
5782  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
5783  * q_vals[eN,k,:] = material_functions[material](x[eN,k],t).flat
5784  *
5785  */
5786  __pyx_t_6 = (__pyx_v_x->dimensions[1]);
5787  __pyx_t_7 = __pyx_t_6;
5788  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_7; __pyx_t_5+=1) {
5789  __pyx_v_k = __pyx_t_5;
5790 
5791  /* "subsurfaceTransportFunctions.pyx":192
5792  * material = elementMaterialTypes[eN]
5793  * for k in range(x.shape[1]):
5794  * q_vals[eN,k,:] = material_functions[material](x[eN,k],t).flat # <<<<<<<<<<<<<<
5795  *
5796  *
5797  */
5798  if (unlikely(__pyx_v_material_functions == Py_None)) {
5799  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5800  __PYX_ERR(0, 192, __pyx_L1_error)
5801  }
5802  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 192, __pyx_L1_error)
5803  __Pyx_GOTREF(__pyx_t_9);
5804  __pyx_t_10 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 192, __pyx_L1_error)
5805  __Pyx_GOTREF(__pyx_t_10);
5806  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5807  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 192, __pyx_L1_error)
5808  __Pyx_GOTREF(__pyx_t_9);
5809  __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 192, __pyx_L1_error)
5810  __Pyx_GOTREF(__pyx_t_11);
5811  __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 192, __pyx_L1_error)
5812  __Pyx_GOTREF(__pyx_t_12);
5813  __Pyx_GIVEREF(__pyx_t_9);
5814  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9);
5815  __Pyx_GIVEREF(__pyx_t_11);
5816  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11);
5817  __pyx_t_9 = 0;
5818  __pyx_t_11 = 0;
5819  __pyx_t_11 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 192, __pyx_L1_error)
5820  __Pyx_GOTREF(__pyx_t_11);
5821  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5822  __pyx_t_12 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 192, __pyx_L1_error)
5823  __Pyx_GOTREF(__pyx_t_12);
5824  __pyx_t_9 = NULL;
5825  __pyx_t_13 = 0;
5826  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
5827  __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
5828  if (likely(__pyx_t_9)) {
5829  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
5830  __Pyx_INCREF(__pyx_t_9);
5831  __Pyx_INCREF(function);
5832  __Pyx_DECREF_SET(__pyx_t_10, function);
5833  __pyx_t_13 = 1;
5834  }
5835  }
5836  #if CYTHON_FAST_PYCALL
5837  if (PyFunction_Check(__pyx_t_10)) {
5838  PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_11, __pyx_t_12};
5839  __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error)
5840  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5841  __Pyx_GOTREF(__pyx_t_8);
5842  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5843  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5844  } else
5845  #endif
5846  #if CYTHON_FAST_PYCCALL
5847  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
5848  PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_11, __pyx_t_12};
5849  __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error)
5850  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5851  __Pyx_GOTREF(__pyx_t_8);
5852  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5853  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5854  } else
5855  #endif
5856  {
5857  __pyx_t_14 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 192, __pyx_L1_error)
5858  __Pyx_GOTREF(__pyx_t_14);
5859  if (__pyx_t_9) {
5860  __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_9); __pyx_t_9 = NULL;
5861  }
5862  __Pyx_GIVEREF(__pyx_t_11);
5863  PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_13, __pyx_t_11);
5864  __Pyx_GIVEREF(__pyx_t_12);
5865  PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_13, __pyx_t_12);
5866  __pyx_t_11 = 0;
5867  __pyx_t_12 = 0;
5868  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error)
5869  __Pyx_GOTREF(__pyx_t_8);
5870  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
5871  }
5872  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5873  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_flat); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 192, __pyx_L1_error)
5874  __Pyx_GOTREF(__pyx_t_10);
5875  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5876  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error)
5877  __Pyx_GOTREF(__pyx_t_8);
5878  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 192, __pyx_L1_error)
5879  __Pyx_GOTREF(__pyx_t_14);
5880  __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 192, __pyx_L1_error)
5881  __Pyx_GOTREF(__pyx_t_12);
5882  __Pyx_GIVEREF(__pyx_t_8);
5883  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_8);
5884  __Pyx_GIVEREF(__pyx_t_14);
5885  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_14);
5886  __Pyx_INCREF(__pyx_slice_);
5887  __Pyx_GIVEREF(__pyx_slice_);
5888  PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_slice_);
5889  __pyx_t_8 = 0;
5890  __pyx_t_14 = 0;
5891  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_q_vals), __pyx_t_12, __pyx_t_10) < 0)) __PYX_ERR(0, 192, __pyx_L1_error)
5892  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5893  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5894  }
5895  }
5896 
5897  /* "subsurfaceTransportFunctions.pyx":180
5898  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
5899  *
5900  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
5901  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
5902  * numpy.ndarray[DTYPE_t,ndim=3] x,
5903  */
5904 
5905  /* function exit code */
5906  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5907  goto __pyx_L0;
5908  __pyx_L1_error:;
5909  __Pyx_XDECREF(__pyx_t_8);
5910  __Pyx_XDECREF(__pyx_t_9);
5911  __Pyx_XDECREF(__pyx_t_10);
5912  __Pyx_XDECREF(__pyx_t_11);
5913  __Pyx_XDECREF(__pyx_t_12);
5914  __Pyx_XDECREF(__pyx_t_14);
5915  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5916  __Pyx_PyThreadState_declare
5917  __Pyx_PyThreadState_assign
5918  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5919  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
5920  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
5921  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5922  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5923  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
5924  __pyx_r = NULL;
5925  goto __pyx_L2;
5926  __pyx_L0:;
5927  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
5928  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
5929  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5930  __pyx_L2:;
5931  __Pyx_XGIVEREF(__pyx_r);
5932  __Pyx_RefNannyFinishContext();
5933  return __pyx_r;
5934 }
5935 
5936 /* "subsurfaceTransportFunctions.pyx":195
5937  *
5938  *
5939  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
5940  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
5941  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
5942  */
5943 
5944 /* Python wrapper */
5945 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5946 static char __pyx_doc_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and evaluate function f(x,t) = 0.5(f^L_j(x,t)+f^R_k(x,t)) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
5947 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage = {"evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage};
5948 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5949  double __pyx_v_t;
5950  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
5951  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
5952  PyArrayObject *__pyx_v_x = 0;
5953  PyArrayObject *__pyx_v_ebq_vals = 0;
5954  PyObject *__pyx_v_material_functions = 0;
5955  PyObject *__pyx_r = 0;
5956  __Pyx_RefNannyDeclarations
5957  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage (wrapper)", 0);
5958  {
5959  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
5960  PyObject* values[6] = {0,0,0,0,0,0};
5961  if (unlikely(__pyx_kwds)) {
5962  Py_ssize_t kw_args;
5963  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5964  switch (pos_args) {
5965  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5966  CYTHON_FALLTHROUGH;
5967  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5968  CYTHON_FALLTHROUGH;
5969  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5970  CYTHON_FALLTHROUGH;
5971  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5972  CYTHON_FALLTHROUGH;
5973  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5974  CYTHON_FALLTHROUGH;
5975  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5976  CYTHON_FALLTHROUGH;
5977  case 0: break;
5978  default: goto __pyx_L5_argtuple_error;
5979  }
5980  kw_args = PyDict_Size(__pyx_kwds);
5981  switch (pos_args) {
5982  case 0:
5983  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
5984  else goto __pyx_L5_argtuple_error;
5985  CYTHON_FALLTHROUGH;
5986  case 1:
5987  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
5988  else {
5989  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 1); __PYX_ERR(0, 195, __pyx_L3_error)
5990  }
5991  CYTHON_FALLTHROUGH;
5992  case 2:
5993  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
5994  else {
5995  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 2); __PYX_ERR(0, 195, __pyx_L3_error)
5996  }
5997  CYTHON_FALLTHROUGH;
5998  case 3:
5999  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
6000  else {
6001  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 3); __PYX_ERR(0, 195, __pyx_L3_error)
6002  }
6003  CYTHON_FALLTHROUGH;
6004  case 4:
6005  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
6006  else {
6007  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 4); __PYX_ERR(0, 195, __pyx_L3_error)
6008  }
6009  CYTHON_FALLTHROUGH;
6010  case 5:
6011  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
6012  else {
6013  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 5); __PYX_ERR(0, 195, __pyx_L3_error)
6014  }
6015  }
6016  if (unlikely(kw_args > 0)) {
6017  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage") < 0)) __PYX_ERR(0, 195, __pyx_L3_error)
6018  }
6019  } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
6020  goto __pyx_L5_argtuple_error;
6021  } else {
6022  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6023  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6024  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6025  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6026  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6027  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6028  }
6029  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L3_error)
6030  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
6031  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
6032  __pyx_v_x = ((PyArrayObject *)values[3]);
6033  __pyx_v_ebq_vals = ((PyArrayObject *)values[4]);
6034  __pyx_v_material_functions = ((PyObject*)values[5]);
6035  }
6036  goto __pyx_L4_argument_unpacking_done;
6037  __pyx_L5_argtuple_error:;
6038  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 195, __pyx_L3_error)
6039  __pyx_L3_error:;
6040  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
6041  __Pyx_RefNannyFinishContext();
6042  return NULL;
6043  __pyx_L4_argument_unpacking_done:;
6044  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 196, __pyx_L1_error)
6045  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 197, __pyx_L1_error)
6046  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 198, __pyx_L1_error)
6047  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) __PYX_ERR(0, 199, __pyx_L1_error)
6048  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 200, __pyx_L1_error)
6049  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_vals, __pyx_v_material_functions);
6050 
6051  /* function exit code */
6052  goto __pyx_L0;
6053  __pyx_L1_error:;
6054  __pyx_r = NULL;
6055  __pyx_L0:;
6056  __Pyx_RefNannyFinishContext();
6057  return __pyx_r;
6058 }
6059 
6060 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
6061  int __pyx_v_eN;
6062  int __pyx_v_ebN;
6063  int __pyx_v_ebN_local;
6064  int __pyx_v_k;
6065  int __pyx_v_material_left;
6066  int __pyx_v_material_right;
6067  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
6068  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
6069  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
6070  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
6071  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
6072  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
6073  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
6074  __Pyx_Buffer __pyx_pybuffer_x;
6075  PyObject *__pyx_r = NULL;
6076  __Pyx_RefNannyDeclarations
6077  npy_intp __pyx_t_1;
6078  npy_intp __pyx_t_2;
6079  int __pyx_t_3;
6080  npy_intp __pyx_t_4;
6081  npy_intp __pyx_t_5;
6082  int __pyx_t_6;
6083  Py_ssize_t __pyx_t_7;
6084  Py_ssize_t __pyx_t_8;
6085  int __pyx_t_9;
6086  Py_ssize_t __pyx_t_10;
6087  Py_ssize_t __pyx_t_11;
6088  Py_ssize_t __pyx_t_12;
6089  Py_ssize_t __pyx_t_13;
6090  npy_intp __pyx_t_14;
6091  npy_intp __pyx_t_15;
6092  PyObject *__pyx_t_16 = NULL;
6093  PyObject *__pyx_t_17 = NULL;
6094  PyObject *__pyx_t_18 = NULL;
6095  PyObject *__pyx_t_19 = NULL;
6096  PyObject *__pyx_t_20 = NULL;
6097  PyObject *__pyx_t_21 = NULL;
6098  int __pyx_t_22;
6099  PyObject *__pyx_t_23 = NULL;
6100  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_24;
6101  Py_ssize_t __pyx_t_25;
6102  Py_ssize_t __pyx_t_26;
6103  Py_ssize_t __pyx_t_27;
6104  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 0);
6105  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
6106  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
6107  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
6108  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
6109  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
6110  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
6111  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
6112  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
6113  __pyx_pybuffer_x.pybuffer.buf = NULL;
6114  __pyx_pybuffer_x.refcount = 0;
6115  __pyx_pybuffernd_x.data = NULL;
6116  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
6117  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
6118  __pyx_pybuffer_ebq_vals.refcount = 0;
6119  __pyx_pybuffernd_ebq_vals.data = NULL;
6120  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
6121  {
6122  __Pyx_BufFmt_StackElem __pyx_stack[1];
6123  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error)
6124  }
6125  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
6126  {
6127  __Pyx_BufFmt_StackElem __pyx_stack[1];
6128  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error)
6129  }
6130  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
6131  {
6132  __Pyx_BufFmt_StackElem __pyx_stack[1];
6133  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error)
6134  }
6135  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
6136  {
6137  __Pyx_BufFmt_StackElem __pyx_stack[1];
6138  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error)
6139  }
6140  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2];
6141 
6142  /* "subsurfaceTransportFunctions.pyx":210
6143  * cdef int eN,ebN,ebN_local,k,material_left,material_right
6144  *
6145  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
6146  * for ebN_local in range(x.shape[1]):
6147  * ebN = elementBoundariesArray[eN,ebN_local]
6148  */
6149  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
6150  __pyx_t_2 = __pyx_t_1;
6151  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
6152  __pyx_v_eN = __pyx_t_3;
6153 
6154  /* "subsurfaceTransportFunctions.pyx":211
6155  *
6156  * for eN in range(x.shape[0]):
6157  * for ebN_local in range(x.shape[1]): # <<<<<<<<<<<<<<
6158  * ebN = elementBoundariesArray[eN,ebN_local]
6159  * material_left = elementBoundaryTypes[ebN,0]
6160  */
6161  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
6162  __pyx_t_5 = __pyx_t_4;
6163  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
6164  __pyx_v_ebN_local = __pyx_t_6;
6165 
6166  /* "subsurfaceTransportFunctions.pyx":212
6167  * for eN in range(x.shape[0]):
6168  * for ebN_local in range(x.shape[1]):
6169  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
6170  * material_left = elementBoundaryTypes[ebN,0]
6171  * material_right= elementBoundaryTypes[ebN,1]
6172  */
6173  __pyx_t_7 = __pyx_v_eN;
6174  __pyx_t_8 = __pyx_v_ebN_local;
6175  __pyx_t_9 = -1;
6176  if (__pyx_t_7 < 0) {
6177  __pyx_t_7 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
6178  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
6179  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_9 = 0;
6180  if (__pyx_t_8 < 0) {
6181  __pyx_t_8 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
6182  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
6183  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_9 = 1;
6184  if (unlikely(__pyx_t_9 != -1)) {
6185  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6186  __PYX_ERR(0, 212, __pyx_L1_error)
6187  }
6188  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
6189 
6190  /* "subsurfaceTransportFunctions.pyx":213
6191  * for ebN_local in range(x.shape[1]):
6192  * ebN = elementBoundariesArray[eN,ebN_local]
6193  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
6194  * material_right= elementBoundaryTypes[ebN,1]
6195  * for k in range(x.shape[2]):
6196  */
6197  __pyx_t_10 = __pyx_v_ebN;
6198  __pyx_t_11 = 0;
6199  __pyx_t_9 = -1;
6200  if (__pyx_t_10 < 0) {
6201  __pyx_t_10 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6202  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
6203  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
6204  if (__pyx_t_11 < 0) {
6205  __pyx_t_11 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6206  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
6207  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
6208  if (unlikely(__pyx_t_9 != -1)) {
6209  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6210  __PYX_ERR(0, 213, __pyx_L1_error)
6211  }
6212  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
6213 
6214  /* "subsurfaceTransportFunctions.pyx":214
6215  * ebN = elementBoundariesArray[eN,ebN_local]
6216  * material_left = elementBoundaryTypes[ebN,0]
6217  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
6218  * for k in range(x.shape[2]):
6219  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+
6220  */
6221  __pyx_t_12 = __pyx_v_ebN;
6222  __pyx_t_13 = 1;
6223  __pyx_t_9 = -1;
6224  if (__pyx_t_12 < 0) {
6225  __pyx_t_12 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6226  if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 0;
6227  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
6228  if (__pyx_t_13 < 0) {
6229  __pyx_t_13 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6230  if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 1;
6231  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
6232  if (unlikely(__pyx_t_9 != -1)) {
6233  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6234  __PYX_ERR(0, 214, __pyx_L1_error)
6235  }
6236  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
6237 
6238  /* "subsurfaceTransportFunctions.pyx":215
6239  * material_left = elementBoundaryTypes[ebN,0]
6240  * material_right= elementBoundaryTypes[ebN,1]
6241  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
6242  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+
6243  * material_functions[material_right](x[eN,ebN_local,k],t))
6244  */
6245  __pyx_t_14 = (__pyx_v_x->dimensions[2]);
6246  __pyx_t_15 = __pyx_t_14;
6247  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_15; __pyx_t_9+=1) {
6248  __pyx_v_k = __pyx_t_9;
6249 
6250  /* "subsurfaceTransportFunctions.pyx":216
6251  * material_right= elementBoundaryTypes[ebN,1]
6252  * for k in range(x.shape[2]):
6253  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+ # <<<<<<<<<<<<<<
6254  * material_functions[material_right](x[eN,ebN_local,k],t))
6255  *
6256  */
6257  if (unlikely(__pyx_v_material_functions == Py_None)) {
6258  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6259  __PYX_ERR(0, 216, __pyx_L1_error)
6260  }
6261  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 216, __pyx_L1_error)
6262  __Pyx_GOTREF(__pyx_t_17);
6263  __pyx_t_18 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_17); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 216, __pyx_L1_error)
6264  __Pyx_GOTREF(__pyx_t_18);
6265  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6266  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 216, __pyx_L1_error)
6267  __Pyx_GOTREF(__pyx_t_17);
6268  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 216, __pyx_L1_error)
6269  __Pyx_GOTREF(__pyx_t_19);
6270  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 216, __pyx_L1_error)
6271  __Pyx_GOTREF(__pyx_t_20);
6272  __pyx_t_21 = PyTuple_New(3); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 216, __pyx_L1_error)
6273  __Pyx_GOTREF(__pyx_t_21);
6274  __Pyx_GIVEREF(__pyx_t_17);
6275  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_17);
6276  __Pyx_GIVEREF(__pyx_t_19);
6277  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_19);
6278  __Pyx_GIVEREF(__pyx_t_20);
6279  PyTuple_SET_ITEM(__pyx_t_21, 2, __pyx_t_20);
6280  __pyx_t_17 = 0;
6281  __pyx_t_19 = 0;
6282  __pyx_t_20 = 0;
6283  __pyx_t_20 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_21); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 216, __pyx_L1_error)
6284  __Pyx_GOTREF(__pyx_t_20);
6285  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6286  __pyx_t_21 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 216, __pyx_L1_error)
6287  __Pyx_GOTREF(__pyx_t_21);
6288  __pyx_t_19 = NULL;
6289  __pyx_t_22 = 0;
6290  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_18))) {
6291  __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_18);
6292  if (likely(__pyx_t_19)) {
6293  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
6294  __Pyx_INCREF(__pyx_t_19);
6295  __Pyx_INCREF(function);
6296  __Pyx_DECREF_SET(__pyx_t_18, function);
6297  __pyx_t_22 = 1;
6298  }
6299  }
6300  #if CYTHON_FAST_PYCALL
6301  if (PyFunction_Check(__pyx_t_18)) {
6302  PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_t_20, __pyx_t_21};
6303  __pyx_t_16 = __Pyx_PyFunction_FastCall(__pyx_t_18, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 216, __pyx_L1_error)
6304  __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
6305  __Pyx_GOTREF(__pyx_t_16);
6306  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
6307  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6308  } else
6309  #endif
6310  #if CYTHON_FAST_PYCCALL
6311  if (__Pyx_PyFastCFunction_Check(__pyx_t_18)) {
6312  PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_t_20, __pyx_t_21};
6313  __pyx_t_16 = __Pyx_PyCFunction_FastCall(__pyx_t_18, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 216, __pyx_L1_error)
6314  __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
6315  __Pyx_GOTREF(__pyx_t_16);
6316  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
6317  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6318  } else
6319  #endif
6320  {
6321  __pyx_t_17 = PyTuple_New(2+__pyx_t_22); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 216, __pyx_L1_error)
6322  __Pyx_GOTREF(__pyx_t_17);
6323  if (__pyx_t_19) {
6324  __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_19); __pyx_t_19 = NULL;
6325  }
6326  __Pyx_GIVEREF(__pyx_t_20);
6327  PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_22, __pyx_t_20);
6328  __Pyx_GIVEREF(__pyx_t_21);
6329  PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_22, __pyx_t_21);
6330  __pyx_t_20 = 0;
6331  __pyx_t_21 = 0;
6332  __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_t_17, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 216, __pyx_L1_error)
6333  __Pyx_GOTREF(__pyx_t_16);
6334  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6335  }
6336  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
6337 
6338  /* "subsurfaceTransportFunctions.pyx":217
6339  * for k in range(x.shape[2]):
6340  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+
6341  * material_functions[material_right](x[eN,ebN_local,k],t)) # <<<<<<<<<<<<<<
6342  *
6343  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd,
6344  */
6345  if (unlikely(__pyx_v_material_functions == Py_None)) {
6346  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6347  __PYX_ERR(0, 217, __pyx_L1_error)
6348  }
6349  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 217, __pyx_L1_error)
6350  __Pyx_GOTREF(__pyx_t_17);
6351  __pyx_t_21 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_17); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 217, __pyx_L1_error)
6352  __Pyx_GOTREF(__pyx_t_21);
6353  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6354  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 217, __pyx_L1_error)
6355  __Pyx_GOTREF(__pyx_t_17);
6356  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 217, __pyx_L1_error)
6357  __Pyx_GOTREF(__pyx_t_20);
6358  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 217, __pyx_L1_error)
6359  __Pyx_GOTREF(__pyx_t_19);
6360  __pyx_t_23 = PyTuple_New(3); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 217, __pyx_L1_error)
6361  __Pyx_GOTREF(__pyx_t_23);
6362  __Pyx_GIVEREF(__pyx_t_17);
6363  PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_17);
6364  __Pyx_GIVEREF(__pyx_t_20);
6365  PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_t_20);
6366  __Pyx_GIVEREF(__pyx_t_19);
6367  PyTuple_SET_ITEM(__pyx_t_23, 2, __pyx_t_19);
6368  __pyx_t_17 = 0;
6369  __pyx_t_20 = 0;
6370  __pyx_t_19 = 0;
6371  __pyx_t_19 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_23); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 217, __pyx_L1_error)
6372  __Pyx_GOTREF(__pyx_t_19);
6373  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
6374  __pyx_t_23 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 217, __pyx_L1_error)
6375  __Pyx_GOTREF(__pyx_t_23);
6376  __pyx_t_20 = NULL;
6377  __pyx_t_22 = 0;
6378  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_21))) {
6379  __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_21);
6380  if (likely(__pyx_t_20)) {
6381  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21);
6382  __Pyx_INCREF(__pyx_t_20);
6383  __Pyx_INCREF(function);
6384  __Pyx_DECREF_SET(__pyx_t_21, function);
6385  __pyx_t_22 = 1;
6386  }
6387  }
6388  #if CYTHON_FAST_PYCALL
6389  if (PyFunction_Check(__pyx_t_21)) {
6390  PyObject *__pyx_temp[3] = {__pyx_t_20, __pyx_t_19, __pyx_t_23};
6391  __pyx_t_18 = __Pyx_PyFunction_FastCall(__pyx_t_21, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 217, __pyx_L1_error)
6392  __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
6393  __Pyx_GOTREF(__pyx_t_18);
6394  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
6395  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
6396  } else
6397  #endif
6398  #if CYTHON_FAST_PYCCALL
6399  if (__Pyx_PyFastCFunction_Check(__pyx_t_21)) {
6400  PyObject *__pyx_temp[3] = {__pyx_t_20, __pyx_t_19, __pyx_t_23};
6401  __pyx_t_18 = __Pyx_PyCFunction_FastCall(__pyx_t_21, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 217, __pyx_L1_error)
6402  __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
6403  __Pyx_GOTREF(__pyx_t_18);
6404  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
6405  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
6406  } else
6407  #endif
6408  {
6409  __pyx_t_17 = PyTuple_New(2+__pyx_t_22); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 217, __pyx_L1_error)
6410  __Pyx_GOTREF(__pyx_t_17);
6411  if (__pyx_t_20) {
6412  __Pyx_GIVEREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_20); __pyx_t_20 = NULL;
6413  }
6414  __Pyx_GIVEREF(__pyx_t_19);
6415  PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_22, __pyx_t_19);
6416  __Pyx_GIVEREF(__pyx_t_23);
6417  PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_22, __pyx_t_23);
6418  __pyx_t_19 = 0;
6419  __pyx_t_23 = 0;
6420  __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_21, __pyx_t_17, NULL); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 217, __pyx_L1_error)
6421  __Pyx_GOTREF(__pyx_t_18);
6422  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6423  }
6424  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6425 
6426  /* "subsurfaceTransportFunctions.pyx":216
6427  * material_right= elementBoundaryTypes[ebN,1]
6428  * for k in range(x.shape[2]):
6429  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+ # <<<<<<<<<<<<<<
6430  * material_functions[material_right](x[eN,ebN_local,k],t))
6431  *
6432  */
6433  __pyx_t_21 = PyNumber_Add(__pyx_t_16, __pyx_t_18); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 216, __pyx_L1_error)
6434  __Pyx_GOTREF(__pyx_t_21);
6435  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6436  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
6437  __pyx_t_18 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_21); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 216, __pyx_L1_error)
6438  __Pyx_GOTREF(__pyx_t_18);
6439  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6440  __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_t_18); if (unlikely((__pyx_t_24 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L1_error)
6441  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
6442  __pyx_t_25 = __pyx_v_eN;
6443  __pyx_t_26 = __pyx_v_ebN_local;
6444  __pyx_t_27 = __pyx_v_k;
6445  __pyx_t_22 = -1;
6446  if (__pyx_t_25 < 0) {
6447  __pyx_t_25 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
6448  if (unlikely(__pyx_t_25 < 0)) __pyx_t_22 = 0;
6449  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_22 = 0;
6450  if (__pyx_t_26 < 0) {
6451  __pyx_t_26 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
6452  if (unlikely(__pyx_t_26 < 0)) __pyx_t_22 = 1;
6453  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_22 = 1;
6454  if (__pyx_t_27 < 0) {
6455  __pyx_t_27 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
6456  if (unlikely(__pyx_t_27 < 0)) __pyx_t_22 = 2;
6457  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_22 = 2;
6458  if (unlikely(__pyx_t_22 != -1)) {
6459  __Pyx_RaiseBufferIndexError(__pyx_t_22);
6460  __PYX_ERR(0, 216, __pyx_L1_error)
6461  }
6462  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_27, __pyx_pybuffernd_ebq_vals.diminfo[2].strides) = __pyx_t_24;
6463  }
6464  }
6465  }
6466 
6467  /* "subsurfaceTransportFunctions.pyx":195
6468  *
6469  *
6470  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
6471  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
6472  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
6473  */
6474 
6475  /* function exit code */
6476  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6477  goto __pyx_L0;
6478  __pyx_L1_error:;
6479  __Pyx_XDECREF(__pyx_t_16);
6480  __Pyx_XDECREF(__pyx_t_17);
6481  __Pyx_XDECREF(__pyx_t_18);
6482  __Pyx_XDECREF(__pyx_t_19);
6483  __Pyx_XDECREF(__pyx_t_20);
6484  __Pyx_XDECREF(__pyx_t_21);
6485  __Pyx_XDECREF(__pyx_t_23);
6486  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
6487  __Pyx_PyThreadState_declare
6488  __Pyx_PyThreadState_assign
6489  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
6490  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
6491  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
6492  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
6493  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
6494  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
6495  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
6496  __pyx_r = NULL;
6497  goto __pyx_L2;
6498  __pyx_L0:;
6499  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
6500  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
6501  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
6502  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
6503  __pyx_L2:;
6504  __Pyx_XGIVEREF(__pyx_r);
6505  __Pyx_RefNannyFinishContext();
6506  return __pyx_r;
6507 }
6508 
6509 /* "subsurfaceTransportFunctions.pyx":219
6510  * material_functions[material_right](x[eN,ebN_local,k],t))
6511  *
6512  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
6513  * double t,
6514  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
6515  */
6516 
6517 /* Python wrapper */
6518 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6519 static char __pyx_doc_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn}(x,t) = f^L_{j,mn}(x,t)f^R_{k,mn}(x,t)/(f^L_{j,mn}(x,t)+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
6520 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage = {"evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage};
6521 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6522  int __pyx_v_nd;
6523  double __pyx_v_t;
6524  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
6525  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
6526  PyArrayObject *__pyx_v_x = 0;
6527  PyArrayObject *__pyx_v_ebq_vals = 0;
6528  PyObject *__pyx_v_material_functions = 0;
6529  PyObject *__pyx_r = 0;
6530  __Pyx_RefNannyDeclarations
6531  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage (wrapper)", 0);
6532  {
6533  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
6534  PyObject* values[7] = {0,0,0,0,0,0,0};
6535  if (unlikely(__pyx_kwds)) {
6536  Py_ssize_t kw_args;
6537  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6538  switch (pos_args) {
6539  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6540  CYTHON_FALLTHROUGH;
6541  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6542  CYTHON_FALLTHROUGH;
6543  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6544  CYTHON_FALLTHROUGH;
6545  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6546  CYTHON_FALLTHROUGH;
6547  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6548  CYTHON_FALLTHROUGH;
6549  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6550  CYTHON_FALLTHROUGH;
6551  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6552  CYTHON_FALLTHROUGH;
6553  case 0: break;
6554  default: goto __pyx_L5_argtuple_error;
6555  }
6556  kw_args = PyDict_Size(__pyx_kwds);
6557  switch (pos_args) {
6558  case 0:
6559  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
6560  else goto __pyx_L5_argtuple_error;
6561  CYTHON_FALLTHROUGH;
6562  case 1:
6563  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
6564  else {
6565  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 1); __PYX_ERR(0, 219, __pyx_L3_error)
6566  }
6567  CYTHON_FALLTHROUGH;
6568  case 2:
6569  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
6570  else {
6571  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 2); __PYX_ERR(0, 219, __pyx_L3_error)
6572  }
6573  CYTHON_FALLTHROUGH;
6574  case 3:
6575  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
6576  else {
6577  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 3); __PYX_ERR(0, 219, __pyx_L3_error)
6578  }
6579  CYTHON_FALLTHROUGH;
6580  case 4:
6581  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
6582  else {
6583  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 4); __PYX_ERR(0, 219, __pyx_L3_error)
6584  }
6585  CYTHON_FALLTHROUGH;
6586  case 5:
6587  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
6588  else {
6589  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 5); __PYX_ERR(0, 219, __pyx_L3_error)
6590  }
6591  CYTHON_FALLTHROUGH;
6592  case 6:
6593  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
6594  else {
6595  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 6); __PYX_ERR(0, 219, __pyx_L3_error)
6596  }
6597  }
6598  if (unlikely(kw_args > 0)) {
6599  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage") < 0)) __PYX_ERR(0, 219, __pyx_L3_error)
6600  }
6601  } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
6602  goto __pyx_L5_argtuple_error;
6603  } else {
6604  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6605  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6606  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6607  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6608  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6609  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6610  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6611  }
6612  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L3_error)
6613  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L3_error)
6614  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[2]);
6615  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[3]);
6616  __pyx_v_x = ((PyArrayObject *)values[4]);
6617  __pyx_v_ebq_vals = ((PyArrayObject *)values[5]);
6618  __pyx_v_material_functions = ((PyObject*)values[6]);
6619  }
6620  goto __pyx_L4_argument_unpacking_done;
6621  __pyx_L5_argtuple_error:;
6622  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 219, __pyx_L3_error)
6623  __pyx_L3_error:;
6624  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
6625  __Pyx_RefNannyFinishContext();
6626  return NULL;
6627  __pyx_L4_argument_unpacking_done:;
6628  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 221, __pyx_L1_error)
6629  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 222, __pyx_L1_error)
6630  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 223, __pyx_L1_error)
6631  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) __PYX_ERR(0, 224, __pyx_L1_error)
6632  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 225, __pyx_L1_error)
6633  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_vals, __pyx_v_material_functions);
6634 
6635  /* function exit code */
6636  goto __pyx_L0;
6637  __pyx_L1_error:;
6638  __pyx_r = NULL;
6639  __pyx_L0:;
6640  __Pyx_RefNannyFinishContext();
6641  return __pyx_r;
6642 }
6643 
6644 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
6645  int __pyx_v_eN;
6646  int __pyx_v_ebN;
6647  int __pyx_v_ebN_local;
6648  int __pyx_v_k;
6649  int __pyx_v_material_left;
6650  int __pyx_v_material_right;
6651  int __pyx_v_I;
6652  int __pyx_v_J;
6653  double __pyx_v_numer;
6654  double __pyx_v_denom;
6655  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
6656  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
6657  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
6658  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
6659  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
6660  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
6661  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
6662  __Pyx_Buffer __pyx_pybuffer_x;
6663  PyObject *__pyx_r = NULL;
6664  __Pyx_RefNannyDeclarations
6665  npy_intp __pyx_t_1;
6666  npy_intp __pyx_t_2;
6667  int __pyx_t_3;
6668  npy_intp __pyx_t_4;
6669  npy_intp __pyx_t_5;
6670  int __pyx_t_6;
6671  Py_ssize_t __pyx_t_7;
6672  Py_ssize_t __pyx_t_8;
6673  int __pyx_t_9;
6674  Py_ssize_t __pyx_t_10;
6675  Py_ssize_t __pyx_t_11;
6676  Py_ssize_t __pyx_t_12;
6677  Py_ssize_t __pyx_t_13;
6678  npy_intp __pyx_t_14;
6679  npy_intp __pyx_t_15;
6680  int __pyx_t_16;
6681  int __pyx_t_17;
6682  int __pyx_t_18;
6683  int __pyx_t_19;
6684  int __pyx_t_20;
6685  int __pyx_t_21;
6686  PyObject *__pyx_t_22 = NULL;
6687  PyObject *__pyx_t_23 = NULL;
6688  PyObject *__pyx_t_24 = NULL;
6689  PyObject *__pyx_t_25 = NULL;
6690  PyObject *__pyx_t_26 = NULL;
6691  PyObject *__pyx_t_27 = NULL;
6692  int __pyx_t_28;
6693  PyObject *__pyx_t_29 = NULL;
6694  double __pyx_t_30;
6695  Py_ssize_t __pyx_t_31;
6696  Py_ssize_t __pyx_t_32;
6697  Py_ssize_t __pyx_t_33;
6698  Py_ssize_t __pyx_t_34;
6699  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 0);
6700  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
6701  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
6702  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
6703  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
6704  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
6705  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
6706  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
6707  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
6708  __pyx_pybuffer_x.pybuffer.buf = NULL;
6709  __pyx_pybuffer_x.refcount = 0;
6710  __pyx_pybuffernd_x.data = NULL;
6711  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
6712  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
6713  __pyx_pybuffer_ebq_vals.refcount = 0;
6714  __pyx_pybuffernd_ebq_vals.data = NULL;
6715  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
6716  {
6717  __Pyx_BufFmt_StackElem __pyx_stack[1];
6718  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 219, __pyx_L1_error)
6719  }
6720  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
6721  {
6722  __Pyx_BufFmt_StackElem __pyx_stack[1];
6723  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 219, __pyx_L1_error)
6724  }
6725  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
6726  {
6727  __Pyx_BufFmt_StackElem __pyx_stack[1];
6728  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 219, __pyx_L1_error)
6729  }
6730  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
6731  {
6732  __Pyx_BufFmt_StackElem __pyx_stack[1];
6733  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 219, __pyx_L1_error)
6734  }
6735  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_ebq_vals.diminfo[3].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_ebq_vals.diminfo[3].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[3];
6736 
6737  /* "subsurfaceTransportFunctions.pyx":236
6738  * cdef double numer,denom
6739  *
6740  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
6741  * for ebN_local in range(x.shape[1]):
6742  * ebN = elementBoundariesArray[eN,ebN_local]
6743  */
6744  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
6745  __pyx_t_2 = __pyx_t_1;
6746  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
6747  __pyx_v_eN = __pyx_t_3;
6748 
6749  /* "subsurfaceTransportFunctions.pyx":237
6750  *
6751  * for eN in range(x.shape[0]):
6752  * for ebN_local in range(x.shape[1]): # <<<<<<<<<<<<<<
6753  * ebN = elementBoundariesArray[eN,ebN_local]
6754  * material_left = elementBoundaryTypes[ebN,0]
6755  */
6756  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
6757  __pyx_t_5 = __pyx_t_4;
6758  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
6759  __pyx_v_ebN_local = __pyx_t_6;
6760 
6761  /* "subsurfaceTransportFunctions.pyx":238
6762  * for eN in range(x.shape[0]):
6763  * for ebN_local in range(x.shape[1]):
6764  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
6765  * material_left = elementBoundaryTypes[ebN,0]
6766  * material_right= elementBoundaryTypes[ebN,1]
6767  */
6768  __pyx_t_7 = __pyx_v_eN;
6769  __pyx_t_8 = __pyx_v_ebN_local;
6770  __pyx_t_9 = -1;
6771  if (__pyx_t_7 < 0) {
6772  __pyx_t_7 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
6773  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
6774  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_9 = 0;
6775  if (__pyx_t_8 < 0) {
6776  __pyx_t_8 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
6777  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
6778  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_9 = 1;
6779  if (unlikely(__pyx_t_9 != -1)) {
6780  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6781  __PYX_ERR(0, 238, __pyx_L1_error)
6782  }
6783  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
6784 
6785  /* "subsurfaceTransportFunctions.pyx":239
6786  * for ebN_local in range(x.shape[1]):
6787  * ebN = elementBoundariesArray[eN,ebN_local]
6788  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
6789  * material_right= elementBoundaryTypes[ebN,1]
6790  * for k in range(x.shape[2]):
6791  */
6792  __pyx_t_10 = __pyx_v_ebN;
6793  __pyx_t_11 = 0;
6794  __pyx_t_9 = -1;
6795  if (__pyx_t_10 < 0) {
6796  __pyx_t_10 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6797  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
6798  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
6799  if (__pyx_t_11 < 0) {
6800  __pyx_t_11 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6801  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
6802  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
6803  if (unlikely(__pyx_t_9 != -1)) {
6804  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6805  __PYX_ERR(0, 239, __pyx_L1_error)
6806  }
6807  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
6808 
6809  /* "subsurfaceTransportFunctions.pyx":240
6810  * ebN = elementBoundariesArray[eN,ebN_local]
6811  * material_left = elementBoundaryTypes[ebN,0]
6812  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
6813  * for k in range(x.shape[2]):
6814  * for I in range(nd):
6815  */
6816  __pyx_t_12 = __pyx_v_ebN;
6817  __pyx_t_13 = 1;
6818  __pyx_t_9 = -1;
6819  if (__pyx_t_12 < 0) {
6820  __pyx_t_12 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6821  if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 0;
6822  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
6823  if (__pyx_t_13 < 0) {
6824  __pyx_t_13 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6825  if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 1;
6826  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
6827  if (unlikely(__pyx_t_9 != -1)) {
6828  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6829  __PYX_ERR(0, 240, __pyx_L1_error)
6830  }
6831  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
6832 
6833  /* "subsurfaceTransportFunctions.pyx":241
6834  * material_left = elementBoundaryTypes[ebN,0]
6835  * material_right= elementBoundaryTypes[ebN,1]
6836  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
6837  * for I in range(nd):
6838  * for J in range(nd):
6839  */
6840  __pyx_t_14 = (__pyx_v_x->dimensions[2]);
6841  __pyx_t_15 = __pyx_t_14;
6842  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_15; __pyx_t_9+=1) {
6843  __pyx_v_k = __pyx_t_9;
6844 
6845  /* "subsurfaceTransportFunctions.pyx":242
6846  * material_right= elementBoundaryTypes[ebN,1]
6847  * for k in range(x.shape[2]):
6848  * for I in range(nd): # <<<<<<<<<<<<<<
6849  * for J in range(nd):
6850  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
6851  */
6852  __pyx_t_16 = __pyx_v_nd;
6853  __pyx_t_17 = __pyx_t_16;
6854  for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
6855  __pyx_v_I = __pyx_t_18;
6856 
6857  /* "subsurfaceTransportFunctions.pyx":243
6858  * for k in range(x.shape[2]):
6859  * for I in range(nd):
6860  * for J in range(nd): # <<<<<<<<<<<<<<
6861  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
6862  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20
6863  */
6864  __pyx_t_19 = __pyx_v_nd;
6865  __pyx_t_20 = __pyx_t_19;
6866  for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
6867  __pyx_v_J = __pyx_t_21;
6868 
6869  /* "subsurfaceTransportFunctions.pyx":244
6870  * for I in range(nd):
6871  * for J in range(nd):
6872  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J] # <<<<<<<<<<<<<<
6873  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20
6874  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
6875  */
6876  if (unlikely(__pyx_v_material_functions == Py_None)) {
6877  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6878  __PYX_ERR(0, 244, __pyx_L1_error)
6879  }
6880  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
6881  __Pyx_GOTREF(__pyx_t_23);
6882  __pyx_t_24 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_23); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 244, __pyx_L1_error)
6883  __Pyx_GOTREF(__pyx_t_24);
6884  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
6885  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
6886  __Pyx_GOTREF(__pyx_t_23);
6887  __pyx_t_25 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 244, __pyx_L1_error)
6888  __Pyx_GOTREF(__pyx_t_25);
6889  __pyx_t_26 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 244, __pyx_L1_error)
6890  __Pyx_GOTREF(__pyx_t_26);
6891  __pyx_t_27 = PyTuple_New(3); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 244, __pyx_L1_error)
6892  __Pyx_GOTREF(__pyx_t_27);
6893  __Pyx_GIVEREF(__pyx_t_23);
6894  PyTuple_SET_ITEM(__pyx_t_27, 0, __pyx_t_23);
6895  __Pyx_GIVEREF(__pyx_t_25);
6896  PyTuple_SET_ITEM(__pyx_t_27, 1, __pyx_t_25);
6897  __Pyx_GIVEREF(__pyx_t_26);
6898  PyTuple_SET_ITEM(__pyx_t_27, 2, __pyx_t_26);
6899  __pyx_t_23 = 0;
6900  __pyx_t_25 = 0;
6901  __pyx_t_26 = 0;
6902  __pyx_t_26 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_27); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 244, __pyx_L1_error)
6903  __Pyx_GOTREF(__pyx_t_26);
6904  __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
6905  __pyx_t_27 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 244, __pyx_L1_error)
6906  __Pyx_GOTREF(__pyx_t_27);
6907  __pyx_t_25 = NULL;
6908  __pyx_t_28 = 0;
6909  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_24))) {
6910  __pyx_t_25 = PyMethod_GET_SELF(__pyx_t_24);
6911  if (likely(__pyx_t_25)) {
6912  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_24);
6913  __Pyx_INCREF(__pyx_t_25);
6914  __Pyx_INCREF(function);
6915  __Pyx_DECREF_SET(__pyx_t_24, function);
6916  __pyx_t_28 = 1;
6917  }
6918  }
6919  #if CYTHON_FAST_PYCALL
6920  if (PyFunction_Check(__pyx_t_24)) {
6921  PyObject *__pyx_temp[3] = {__pyx_t_25, __pyx_t_26, __pyx_t_27};
6922  __pyx_t_22 = __Pyx_PyFunction_FastCall(__pyx_t_24, __pyx_temp+1-__pyx_t_28, 2+__pyx_t_28); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
6923  __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
6924  __Pyx_GOTREF(__pyx_t_22);
6925  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
6926  __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
6927  } else
6928  #endif
6929  #if CYTHON_FAST_PYCCALL
6930  if (__Pyx_PyFastCFunction_Check(__pyx_t_24)) {
6931  PyObject *__pyx_temp[3] = {__pyx_t_25, __pyx_t_26, __pyx_t_27};
6932  __pyx_t_22 = __Pyx_PyCFunction_FastCall(__pyx_t_24, __pyx_temp+1-__pyx_t_28, 2+__pyx_t_28); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
6933  __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
6934  __Pyx_GOTREF(__pyx_t_22);
6935  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
6936  __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
6937  } else
6938  #endif
6939  {
6940  __pyx_t_23 = PyTuple_New(2+__pyx_t_28); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
6941  __Pyx_GOTREF(__pyx_t_23);
6942  if (__pyx_t_25) {
6943  __Pyx_GIVEREF(__pyx_t_25); PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_25); __pyx_t_25 = NULL;
6944  }
6945  __Pyx_GIVEREF(__pyx_t_26);
6946  PyTuple_SET_ITEM(__pyx_t_23, 0+__pyx_t_28, __pyx_t_26);
6947  __Pyx_GIVEREF(__pyx_t_27);
6948  PyTuple_SET_ITEM(__pyx_t_23, 1+__pyx_t_28, __pyx_t_27);
6949  __pyx_t_26 = 0;
6950  __pyx_t_27 = 0;
6951  __pyx_t_22 = __Pyx_PyObject_Call(__pyx_t_24, __pyx_t_23, NULL); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
6952  __Pyx_GOTREF(__pyx_t_22);
6953  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
6954  }
6955  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
6956  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 244, __pyx_L1_error)
6957  __Pyx_GOTREF(__pyx_t_24);
6958  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
6959  __Pyx_GOTREF(__pyx_t_23);
6960  __pyx_t_27 = PyTuple_New(2); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 244, __pyx_L1_error)
6961  __Pyx_GOTREF(__pyx_t_27);
6962  __Pyx_GIVEREF(__pyx_t_24);
6963  PyTuple_SET_ITEM(__pyx_t_27, 0, __pyx_t_24);
6964  __Pyx_GIVEREF(__pyx_t_23);
6965  PyTuple_SET_ITEM(__pyx_t_27, 1, __pyx_t_23);
6966  __pyx_t_24 = 0;
6967  __pyx_t_23 = 0;
6968  __pyx_t_23 = __Pyx_PyObject_GetItem(__pyx_t_22, __pyx_t_27); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
6969  __Pyx_GOTREF(__pyx_t_23);
6970  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
6971  __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
6972  __pyx_t_27 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_23); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 244, __pyx_L1_error)
6973  __Pyx_GOTREF(__pyx_t_27);
6974  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
6975  if (unlikely(__pyx_v_material_functions == Py_None)) {
6976  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6977  __PYX_ERR(0, 244, __pyx_L1_error)
6978  }
6979  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
6980  __Pyx_GOTREF(__pyx_t_22);
6981  __pyx_t_24 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_22); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 244, __pyx_L1_error)
6982  __Pyx_GOTREF(__pyx_t_24);
6983  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
6984  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
6985  __Pyx_GOTREF(__pyx_t_22);
6986  __pyx_t_26 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 244, __pyx_L1_error)
6987  __Pyx_GOTREF(__pyx_t_26);
6988  __pyx_t_25 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 244, __pyx_L1_error)
6989  __Pyx_GOTREF(__pyx_t_25);
6990  __pyx_t_29 = PyTuple_New(3); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 244, __pyx_L1_error)
6991  __Pyx_GOTREF(__pyx_t_29);
6992  __Pyx_GIVEREF(__pyx_t_22);
6993  PyTuple_SET_ITEM(__pyx_t_29, 0, __pyx_t_22);
6994  __Pyx_GIVEREF(__pyx_t_26);
6995  PyTuple_SET_ITEM(__pyx_t_29, 1, __pyx_t_26);
6996  __Pyx_GIVEREF(__pyx_t_25);
6997  PyTuple_SET_ITEM(__pyx_t_29, 2, __pyx_t_25);
6998  __pyx_t_22 = 0;
6999  __pyx_t_26 = 0;
7000  __pyx_t_25 = 0;
7001  __pyx_t_25 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_29); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 244, __pyx_L1_error)
7002  __Pyx_GOTREF(__pyx_t_25);
7003  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
7004  __pyx_t_29 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 244, __pyx_L1_error)
7005  __Pyx_GOTREF(__pyx_t_29);
7006  __pyx_t_26 = NULL;
7007  __pyx_t_28 = 0;
7008  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_24))) {
7009  __pyx_t_26 = PyMethod_GET_SELF(__pyx_t_24);
7010  if (likely(__pyx_t_26)) {
7011  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_24);
7012  __Pyx_INCREF(__pyx_t_26);
7013  __Pyx_INCREF(function);
7014  __Pyx_DECREF_SET(__pyx_t_24, function);
7015  __pyx_t_28 = 1;
7016  }
7017  }
7018  #if CYTHON_FAST_PYCALL
7019  if (PyFunction_Check(__pyx_t_24)) {
7020  PyObject *__pyx_temp[3] = {__pyx_t_26, __pyx_t_25, __pyx_t_29};
7021  __pyx_t_23 = __Pyx_PyFunction_FastCall(__pyx_t_24, __pyx_temp+1-__pyx_t_28, 2+__pyx_t_28); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
7022  __Pyx_XDECREF(__pyx_t_26); __pyx_t_26 = 0;
7023  __Pyx_GOTREF(__pyx_t_23);
7024  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7025  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
7026  } else
7027  #endif
7028  #if CYTHON_FAST_PYCCALL
7029  if (__Pyx_PyFastCFunction_Check(__pyx_t_24)) {
7030  PyObject *__pyx_temp[3] = {__pyx_t_26, __pyx_t_25, __pyx_t_29};
7031  __pyx_t_23 = __Pyx_PyCFunction_FastCall(__pyx_t_24, __pyx_temp+1-__pyx_t_28, 2+__pyx_t_28); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
7032  __Pyx_XDECREF(__pyx_t_26); __pyx_t_26 = 0;
7033  __Pyx_GOTREF(__pyx_t_23);
7034  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7035  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
7036  } else
7037  #endif
7038  {
7039  __pyx_t_22 = PyTuple_New(2+__pyx_t_28); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
7040  __Pyx_GOTREF(__pyx_t_22);
7041  if (__pyx_t_26) {
7042  __Pyx_GIVEREF(__pyx_t_26); PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_26); __pyx_t_26 = NULL;
7043  }
7044  __Pyx_GIVEREF(__pyx_t_25);
7045  PyTuple_SET_ITEM(__pyx_t_22, 0+__pyx_t_28, __pyx_t_25);
7046  __Pyx_GIVEREF(__pyx_t_29);
7047  PyTuple_SET_ITEM(__pyx_t_22, 1+__pyx_t_28, __pyx_t_29);
7048  __pyx_t_25 = 0;
7049  __pyx_t_29 = 0;
7050  __pyx_t_23 = __Pyx_PyObject_Call(__pyx_t_24, __pyx_t_22, NULL); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
7051  __Pyx_GOTREF(__pyx_t_23);
7052  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7053  }
7054  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
7055  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 244, __pyx_L1_error)
7056  __Pyx_GOTREF(__pyx_t_24);
7057  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
7058  __Pyx_GOTREF(__pyx_t_22);
7059  __pyx_t_29 = PyTuple_New(2); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 244, __pyx_L1_error)
7060  __Pyx_GOTREF(__pyx_t_29);
7061  __Pyx_GIVEREF(__pyx_t_24);
7062  PyTuple_SET_ITEM(__pyx_t_29, 0, __pyx_t_24);
7063  __Pyx_GIVEREF(__pyx_t_22);
7064  PyTuple_SET_ITEM(__pyx_t_29, 1, __pyx_t_22);
7065  __pyx_t_24 = 0;
7066  __pyx_t_22 = 0;
7067  __pyx_t_22 = __Pyx_PyObject_GetItem(__pyx_t_23, __pyx_t_29); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
7068  __Pyx_GOTREF(__pyx_t_22);
7069  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
7070  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
7071  __pyx_t_29 = PyNumber_Multiply(__pyx_t_27, __pyx_t_22); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 244, __pyx_L1_error)
7072  __Pyx_GOTREF(__pyx_t_29);
7073  __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
7074  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7075  __pyx_t_30 = __pyx_PyFloat_AsDouble(__pyx_t_29); if (unlikely((__pyx_t_30 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 244, __pyx_L1_error)
7076  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
7077  __pyx_v_numer = __pyx_t_30;
7078 
7079  /* "subsurfaceTransportFunctions.pyx":245
7080  * for J in range(nd):
7081  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
7082  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20 # <<<<<<<<<<<<<<
7083  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
7084  *
7085  */
7086  if (unlikely(__pyx_v_material_functions == Py_None)) {
7087  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7088  __PYX_ERR(0, 245, __pyx_L1_error)
7089  }
7090  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
7091  __Pyx_GOTREF(__pyx_t_22);
7092  __pyx_t_27 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_22); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 245, __pyx_L1_error)
7093  __Pyx_GOTREF(__pyx_t_27);
7094  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7095  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
7096  __Pyx_GOTREF(__pyx_t_22);
7097  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 245, __pyx_L1_error)
7098  __Pyx_GOTREF(__pyx_t_23);
7099  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 245, __pyx_L1_error)
7100  __Pyx_GOTREF(__pyx_t_24);
7101  __pyx_t_25 = PyTuple_New(3); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7102  __Pyx_GOTREF(__pyx_t_25);
7103  __Pyx_GIVEREF(__pyx_t_22);
7104  PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_22);
7105  __Pyx_GIVEREF(__pyx_t_23);
7106  PyTuple_SET_ITEM(__pyx_t_25, 1, __pyx_t_23);
7107  __Pyx_GIVEREF(__pyx_t_24);
7108  PyTuple_SET_ITEM(__pyx_t_25, 2, __pyx_t_24);
7109  __pyx_t_22 = 0;
7110  __pyx_t_23 = 0;
7111  __pyx_t_24 = 0;
7112  __pyx_t_24 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_25); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 245, __pyx_L1_error)
7113  __Pyx_GOTREF(__pyx_t_24);
7114  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7115  __pyx_t_25 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7116  __Pyx_GOTREF(__pyx_t_25);
7117  __pyx_t_23 = NULL;
7118  __pyx_t_28 = 0;
7119  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_27))) {
7120  __pyx_t_23 = PyMethod_GET_SELF(__pyx_t_27);
7121  if (likely(__pyx_t_23)) {
7122  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_27);
7123  __Pyx_INCREF(__pyx_t_23);
7124  __Pyx_INCREF(function);
7125  __Pyx_DECREF_SET(__pyx_t_27, function);
7126  __pyx_t_28 = 1;
7127  }
7128  }
7129  #if CYTHON_FAST_PYCALL
7130  if (PyFunction_Check(__pyx_t_27)) {
7131  PyObject *__pyx_temp[3] = {__pyx_t_23, __pyx_t_24, __pyx_t_25};
7132  __pyx_t_29 = __Pyx_PyFunction_FastCall(__pyx_t_27, __pyx_temp+1-__pyx_t_28, 2+__pyx_t_28); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 245, __pyx_L1_error)
7133  __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
7134  __Pyx_GOTREF(__pyx_t_29);
7135  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
7136  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7137  } else
7138  #endif
7139  #if CYTHON_FAST_PYCCALL
7140  if (__Pyx_PyFastCFunction_Check(__pyx_t_27)) {
7141  PyObject *__pyx_temp[3] = {__pyx_t_23, __pyx_t_24, __pyx_t_25};
7142  __pyx_t_29 = __Pyx_PyCFunction_FastCall(__pyx_t_27, __pyx_temp+1-__pyx_t_28, 2+__pyx_t_28); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 245, __pyx_L1_error)
7143  __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
7144  __Pyx_GOTREF(__pyx_t_29);
7145  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
7146  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7147  } else
7148  #endif
7149  {
7150  __pyx_t_22 = PyTuple_New(2+__pyx_t_28); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
7151  __Pyx_GOTREF(__pyx_t_22);
7152  if (__pyx_t_23) {
7153  __Pyx_GIVEREF(__pyx_t_23); PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_23); __pyx_t_23 = NULL;
7154  }
7155  __Pyx_GIVEREF(__pyx_t_24);
7156  PyTuple_SET_ITEM(__pyx_t_22, 0+__pyx_t_28, __pyx_t_24);
7157  __Pyx_GIVEREF(__pyx_t_25);
7158  PyTuple_SET_ITEM(__pyx_t_22, 1+__pyx_t_28, __pyx_t_25);
7159  __pyx_t_24 = 0;
7160  __pyx_t_25 = 0;
7161  __pyx_t_29 = __Pyx_PyObject_Call(__pyx_t_27, __pyx_t_22, NULL); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 245, __pyx_L1_error)
7162  __Pyx_GOTREF(__pyx_t_29);
7163  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7164  }
7165  __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
7166  __pyx_t_27 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 245, __pyx_L1_error)
7167  __Pyx_GOTREF(__pyx_t_27);
7168  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
7169  __Pyx_GOTREF(__pyx_t_22);
7170  __pyx_t_25 = PyTuple_New(2); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7171  __Pyx_GOTREF(__pyx_t_25);
7172  __Pyx_GIVEREF(__pyx_t_27);
7173  PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_27);
7174  __Pyx_GIVEREF(__pyx_t_22);
7175  PyTuple_SET_ITEM(__pyx_t_25, 1, __pyx_t_22);
7176  __pyx_t_27 = 0;
7177  __pyx_t_22 = 0;
7178  __pyx_t_22 = __Pyx_PyObject_GetItem(__pyx_t_29, __pyx_t_25); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
7179  __Pyx_GOTREF(__pyx_t_22);
7180  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
7181  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7182  if (unlikely(__pyx_v_material_functions == Py_None)) {
7183  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7184  __PYX_ERR(0, 245, __pyx_L1_error)
7185  }
7186  __pyx_t_29 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 245, __pyx_L1_error)
7187  __Pyx_GOTREF(__pyx_t_29);
7188  __pyx_t_27 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_29); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 245, __pyx_L1_error)
7189  __Pyx_GOTREF(__pyx_t_27);
7190  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
7191  __pyx_t_29 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 245, __pyx_L1_error)
7192  __Pyx_GOTREF(__pyx_t_29);
7193  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 245, __pyx_L1_error)
7194  __Pyx_GOTREF(__pyx_t_24);
7195  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 245, __pyx_L1_error)
7196  __Pyx_GOTREF(__pyx_t_23);
7197  __pyx_t_26 = PyTuple_New(3); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 245, __pyx_L1_error)
7198  __Pyx_GOTREF(__pyx_t_26);
7199  __Pyx_GIVEREF(__pyx_t_29);
7200  PyTuple_SET_ITEM(__pyx_t_26, 0, __pyx_t_29);
7201  __Pyx_GIVEREF(__pyx_t_24);
7202  PyTuple_SET_ITEM(__pyx_t_26, 1, __pyx_t_24);
7203  __Pyx_GIVEREF(__pyx_t_23);
7204  PyTuple_SET_ITEM(__pyx_t_26, 2, __pyx_t_23);
7205  __pyx_t_29 = 0;
7206  __pyx_t_24 = 0;
7207  __pyx_t_23 = 0;
7208  __pyx_t_23 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_26); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 245, __pyx_L1_error)
7209  __Pyx_GOTREF(__pyx_t_23);
7210  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
7211  __pyx_t_26 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 245, __pyx_L1_error)
7212  __Pyx_GOTREF(__pyx_t_26);
7213  __pyx_t_24 = NULL;
7214  __pyx_t_28 = 0;
7215  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_27))) {
7216  __pyx_t_24 = PyMethod_GET_SELF(__pyx_t_27);
7217  if (likely(__pyx_t_24)) {
7218  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_27);
7219  __Pyx_INCREF(__pyx_t_24);
7220  __Pyx_INCREF(function);
7221  __Pyx_DECREF_SET(__pyx_t_27, function);
7222  __pyx_t_28 = 1;
7223  }
7224  }
7225  #if CYTHON_FAST_PYCALL
7226  if (PyFunction_Check(__pyx_t_27)) {
7227  PyObject *__pyx_temp[3] = {__pyx_t_24, __pyx_t_23, __pyx_t_26};
7228  __pyx_t_25 = __Pyx_PyFunction_FastCall(__pyx_t_27, __pyx_temp+1-__pyx_t_28, 2+__pyx_t_28); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7229  __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
7230  __Pyx_GOTREF(__pyx_t_25);
7231  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
7232  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
7233  } else
7234  #endif
7235  #if CYTHON_FAST_PYCCALL
7236  if (__Pyx_PyFastCFunction_Check(__pyx_t_27)) {
7237  PyObject *__pyx_temp[3] = {__pyx_t_24, __pyx_t_23, __pyx_t_26};
7238  __pyx_t_25 = __Pyx_PyCFunction_FastCall(__pyx_t_27, __pyx_temp+1-__pyx_t_28, 2+__pyx_t_28); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7239  __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
7240  __Pyx_GOTREF(__pyx_t_25);
7241  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
7242  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
7243  } else
7244  #endif
7245  {
7246  __pyx_t_29 = PyTuple_New(2+__pyx_t_28); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 245, __pyx_L1_error)
7247  __Pyx_GOTREF(__pyx_t_29);
7248  if (__pyx_t_24) {
7249  __Pyx_GIVEREF(__pyx_t_24); PyTuple_SET_ITEM(__pyx_t_29, 0, __pyx_t_24); __pyx_t_24 = NULL;
7250  }
7251  __Pyx_GIVEREF(__pyx_t_23);
7252  PyTuple_SET_ITEM(__pyx_t_29, 0+__pyx_t_28, __pyx_t_23);
7253  __Pyx_GIVEREF(__pyx_t_26);
7254  PyTuple_SET_ITEM(__pyx_t_29, 1+__pyx_t_28, __pyx_t_26);
7255  __pyx_t_23 = 0;
7256  __pyx_t_26 = 0;
7257  __pyx_t_25 = __Pyx_PyObject_Call(__pyx_t_27, __pyx_t_29, NULL); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7258  __Pyx_GOTREF(__pyx_t_25);
7259  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
7260  }
7261  __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
7262  __pyx_t_27 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 245, __pyx_L1_error)
7263  __Pyx_GOTREF(__pyx_t_27);
7264  __pyx_t_29 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 245, __pyx_L1_error)
7265  __Pyx_GOTREF(__pyx_t_29);
7266  __pyx_t_26 = PyTuple_New(2); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 245, __pyx_L1_error)
7267  __Pyx_GOTREF(__pyx_t_26);
7268  __Pyx_GIVEREF(__pyx_t_27);
7269  PyTuple_SET_ITEM(__pyx_t_26, 0, __pyx_t_27);
7270  __Pyx_GIVEREF(__pyx_t_29);
7271  PyTuple_SET_ITEM(__pyx_t_26, 1, __pyx_t_29);
7272  __pyx_t_27 = 0;
7273  __pyx_t_29 = 0;
7274  __pyx_t_29 = __Pyx_PyObject_GetItem(__pyx_t_25, __pyx_t_26); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 245, __pyx_L1_error)
7275  __Pyx_GOTREF(__pyx_t_29);
7276  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7277  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
7278  __pyx_t_26 = PyNumber_Add(__pyx_t_22, __pyx_t_29); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 245, __pyx_L1_error)
7279  __Pyx_GOTREF(__pyx_t_26);
7280  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7281  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
7282  __pyx_t_29 = __Pyx_PyFloat_AddObjC(__pyx_t_26, __pyx_float_1_0eneg_20, 1.0e-20, 0, 0); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 245, __pyx_L1_error)
7283  __Pyx_GOTREF(__pyx_t_29);
7284  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
7285  __pyx_t_30 = __pyx_PyFloat_AsDouble(__pyx_t_29); if (unlikely((__pyx_t_30 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L1_error)
7286  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
7287  __pyx_v_denom = __pyx_t_30;
7288 
7289  /* "subsurfaceTransportFunctions.pyx":246
7290  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
7291  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20
7292  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
7293  *
7294  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t,
7295  */
7296  if (unlikely(__pyx_v_denom == 0)) {
7297  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
7298  __PYX_ERR(0, 246, __pyx_L1_error)
7299  }
7300  __pyx_t_31 = __pyx_v_eN;
7301  __pyx_t_32 = __pyx_v_ebN_local;
7302  __pyx_t_33 = __pyx_v_k;
7303  __pyx_t_34 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
7304  __pyx_t_28 = -1;
7305  if (__pyx_t_31 < 0) {
7306  __pyx_t_31 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
7307  if (unlikely(__pyx_t_31 < 0)) __pyx_t_28 = 0;
7308  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_28 = 0;
7309  if (__pyx_t_32 < 0) {
7310  __pyx_t_32 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
7311  if (unlikely(__pyx_t_32 < 0)) __pyx_t_28 = 1;
7312  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_28 = 1;
7313  if (__pyx_t_33 < 0) {
7314  __pyx_t_33 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
7315  if (unlikely(__pyx_t_33 < 0)) __pyx_t_28 = 2;
7316  } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_28 = 2;
7317  if (__pyx_t_34 < 0) {
7318  __pyx_t_34 += __pyx_pybuffernd_ebq_vals.diminfo[3].shape;
7319  if (unlikely(__pyx_t_34 < 0)) __pyx_t_28 = 3;
7320  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_ebq_vals.diminfo[3].shape)) __pyx_t_28 = 3;
7321  if (unlikely(__pyx_t_28 != -1)) {
7322  __Pyx_RaiseBufferIndexError(__pyx_t_28);
7323  __PYX_ERR(0, 246, __pyx_L1_error)
7324  }
7325  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_33, __pyx_pybuffernd_ebq_vals.diminfo[2].strides, __pyx_t_34, __pyx_pybuffernd_ebq_vals.diminfo[3].strides) = (__pyx_v_numer / __pyx_v_denom);
7326  }
7327  }
7328  }
7329  }
7330  }
7331 
7332  /* "subsurfaceTransportFunctions.pyx":219
7333  * material_functions[material_right](x[eN,ebN_local,k],t))
7334  *
7335  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
7336  * double t,
7337  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
7338  */
7339 
7340  /* function exit code */
7341  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7342  goto __pyx_L0;
7343  __pyx_L1_error:;
7344  __Pyx_XDECREF(__pyx_t_22);
7345  __Pyx_XDECREF(__pyx_t_23);
7346  __Pyx_XDECREF(__pyx_t_24);
7347  __Pyx_XDECREF(__pyx_t_25);
7348  __Pyx_XDECREF(__pyx_t_26);
7349  __Pyx_XDECREF(__pyx_t_27);
7350  __Pyx_XDECREF(__pyx_t_29);
7351  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
7352  __Pyx_PyThreadState_declare
7353  __Pyx_PyThreadState_assign
7354  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
7355  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
7356  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
7357  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
7358  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7359  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
7360  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
7361  __pyx_r = NULL;
7362  goto __pyx_L2;
7363  __pyx_L0:;
7364  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
7365  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
7366  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
7367  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7368  __pyx_L2:;
7369  __Pyx_XGIVEREF(__pyx_r);
7370  __Pyx_RefNannyFinishContext();
7371  return __pyx_r;
7372 }
7373 
7374 /* "subsurfaceTransportFunctions.pyx":248
7375  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
7376  *
7377  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
7378  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
7379  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
7380  */
7381 
7382 /* Python wrapper */
7383 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7384 static char __pyx_doc_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and evaluate function f(x,t) = 0.5(f^L_j(x,t)+f^R_k(x,t)) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
7385 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage = {"evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage};
7386 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7387  double __pyx_v_t;
7388  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
7389  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
7390  PyArrayObject *__pyx_v_x = 0;
7391  PyArrayObject *__pyx_v_ebq_global_vals = 0;
7392  PyObject *__pyx_v_material_functions = 0;
7393  PyObject *__pyx_r = 0;
7394  __Pyx_RefNannyDeclarations
7395  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage (wrapper)", 0);
7396  {
7397  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
7398  PyObject* values[6] = {0,0,0,0,0,0};
7399  if (unlikely(__pyx_kwds)) {
7400  Py_ssize_t kw_args;
7401  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7402  switch (pos_args) {
7403  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7404  CYTHON_FALLTHROUGH;
7405  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7406  CYTHON_FALLTHROUGH;
7407  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7408  CYTHON_FALLTHROUGH;
7409  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7410  CYTHON_FALLTHROUGH;
7411  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7412  CYTHON_FALLTHROUGH;
7413  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7414  CYTHON_FALLTHROUGH;
7415  case 0: break;
7416  default: goto __pyx_L5_argtuple_error;
7417  }
7418  kw_args = PyDict_Size(__pyx_kwds);
7419  switch (pos_args) {
7420  case 0:
7421  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
7422  else goto __pyx_L5_argtuple_error;
7423  CYTHON_FALLTHROUGH;
7424  case 1:
7425  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
7426  else {
7427  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 1); __PYX_ERR(0, 248, __pyx_L3_error)
7428  }
7429  CYTHON_FALLTHROUGH;
7430  case 2:
7431  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
7432  else {
7433  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 2); __PYX_ERR(0, 248, __pyx_L3_error)
7434  }
7435  CYTHON_FALLTHROUGH;
7436  case 3:
7437  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
7438  else {
7439  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 3); __PYX_ERR(0, 248, __pyx_L3_error)
7440  }
7441  CYTHON_FALLTHROUGH;
7442  case 4:
7443  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
7444  else {
7445  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 4); __PYX_ERR(0, 248, __pyx_L3_error)
7446  }
7447  CYTHON_FALLTHROUGH;
7448  case 5:
7449  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
7450  else {
7451  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 5); __PYX_ERR(0, 248, __pyx_L3_error)
7452  }
7453  }
7454  if (unlikely(kw_args > 0)) {
7455  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage") < 0)) __PYX_ERR(0, 248, __pyx_L3_error)
7456  }
7457  } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
7458  goto __pyx_L5_argtuple_error;
7459  } else {
7460  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7461  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7462  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7463  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7464  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7465  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7466  }
7467  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 248, __pyx_L3_error)
7468  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
7469  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
7470  __pyx_v_x = ((PyArrayObject *)values[3]);
7471  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[4]);
7472  __pyx_v_material_functions = ((PyObject*)values[5]);
7473  }
7474  goto __pyx_L4_argument_unpacking_done;
7475  __pyx_L5_argtuple_error:;
7476  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 248, __pyx_L3_error)
7477  __pyx_L3_error:;
7478  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
7479  __Pyx_RefNannyFinishContext();
7480  return NULL;
7481  __pyx_L4_argument_unpacking_done:;
7482  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 249, __pyx_L1_error)
7483  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 250, __pyx_L1_error)
7484  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 251, __pyx_L1_error)
7485  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) __PYX_ERR(0, 252, __pyx_L1_error)
7486  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 253, __pyx_L1_error)
7487  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
7488 
7489  /* function exit code */
7490  goto __pyx_L0;
7491  __pyx_L1_error:;
7492  __pyx_r = NULL;
7493  __pyx_L0:;
7494  __Pyx_RefNannyFinishContext();
7495  return __pyx_r;
7496 }
7497 
7498 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
7499  int __pyx_v_ebN;
7500  int __pyx_v_material_left;
7501  int __pyx_v_material_right;
7502  npy_intp __pyx_v_k;
7503  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
7504  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
7505  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
7506  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
7507  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
7508  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
7509  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
7510  __Pyx_Buffer __pyx_pybuffer_x;
7511  PyObject *__pyx_r = NULL;
7512  __Pyx_RefNannyDeclarations
7513  npy_intp __pyx_t_1;
7514  npy_intp __pyx_t_2;
7515  int __pyx_t_3;
7516  Py_ssize_t __pyx_t_4;
7517  Py_ssize_t __pyx_t_5;
7518  int __pyx_t_6;
7519  Py_ssize_t __pyx_t_7;
7520  Py_ssize_t __pyx_t_8;
7521  npy_intp __pyx_t_9;
7522  npy_intp __pyx_t_10;
7523  npy_intp __pyx_t_11;
7524  PyObject *__pyx_t_12 = NULL;
7525  PyObject *__pyx_t_13 = NULL;
7526  PyObject *__pyx_t_14 = NULL;
7527  PyObject *__pyx_t_15 = NULL;
7528  PyObject *__pyx_t_16 = NULL;
7529  PyObject *__pyx_t_17 = NULL;
7530  PyObject *__pyx_t_18 = NULL;
7531  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_19;
7532  Py_ssize_t __pyx_t_20;
7533  Py_ssize_t __pyx_t_21;
7534  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 0);
7535  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
7536  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
7537  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
7538  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
7539  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
7540  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
7541  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
7542  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
7543  __pyx_pybuffer_x.pybuffer.buf = NULL;
7544  __pyx_pybuffer_x.refcount = 0;
7545  __pyx_pybuffernd_x.data = NULL;
7546  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
7547  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
7548  __pyx_pybuffer_ebq_global_vals.refcount = 0;
7549  __pyx_pybuffernd_ebq_global_vals.data = NULL;
7550  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
7551  {
7552  __Pyx_BufFmt_StackElem __pyx_stack[1];
7553  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 248, __pyx_L1_error)
7554  }
7555  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
7556  {
7557  __Pyx_BufFmt_StackElem __pyx_stack[1];
7558  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 248, __pyx_L1_error)
7559  }
7560  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
7561  {
7562  __Pyx_BufFmt_StackElem __pyx_stack[1];
7563  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 248, __pyx_L1_error)
7564  }
7565  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
7566  {
7567  __Pyx_BufFmt_StackElem __pyx_stack[1];
7568  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 248, __pyx_L1_error)
7569  }
7570  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1];
7571 
7572  /* "subsurfaceTransportFunctions.pyx":263
7573  * cdef int ebN,material_left,material_right
7574  *
7575  * for ebN in range(x.shape[0]): # <<<<<<<<<<<<<<
7576  * material_left = elementBoundaryTypes[ebN,0]
7577  * material_right= elementBoundaryTypes[ebN,1]
7578  */
7579  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
7580  __pyx_t_2 = __pyx_t_1;
7581  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
7582  __pyx_v_ebN = __pyx_t_3;
7583 
7584  /* "subsurfaceTransportFunctions.pyx":264
7585  *
7586  * for ebN in range(x.shape[0]):
7587  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
7588  * material_right= elementBoundaryTypes[ebN,1]
7589  * for k in range(x.shape[1]):
7590  */
7591  __pyx_t_4 = __pyx_v_ebN;
7592  __pyx_t_5 = 0;
7593  __pyx_t_6 = -1;
7594  if (__pyx_t_4 < 0) {
7595  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
7596  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
7597  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
7598  if (__pyx_t_5 < 0) {
7599  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
7600  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
7601  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
7602  if (unlikely(__pyx_t_6 != -1)) {
7603  __Pyx_RaiseBufferIndexError(__pyx_t_6);
7604  __PYX_ERR(0, 264, __pyx_L1_error)
7605  }
7606  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
7607 
7608  /* "subsurfaceTransportFunctions.pyx":265
7609  * for ebN in range(x.shape[0]):
7610  * material_left = elementBoundaryTypes[ebN,0]
7611  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
7612  * for k in range(x.shape[1]):
7613  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+
7614  */
7615  __pyx_t_7 = __pyx_v_ebN;
7616  __pyx_t_8 = 1;
7617  __pyx_t_6 = -1;
7618  if (__pyx_t_7 < 0) {
7619  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
7620  if (unlikely(__pyx_t_7 < 0)) __pyx_t_6 = 0;
7621  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
7622  if (__pyx_t_8 < 0) {
7623  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
7624  if (unlikely(__pyx_t_8 < 0)) __pyx_t_6 = 1;
7625  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
7626  if (unlikely(__pyx_t_6 != -1)) {
7627  __Pyx_RaiseBufferIndexError(__pyx_t_6);
7628  __PYX_ERR(0, 265, __pyx_L1_error)
7629  }
7630  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
7631 
7632  /* "subsurfaceTransportFunctions.pyx":266
7633  * material_left = elementBoundaryTypes[ebN,0]
7634  * material_right= elementBoundaryTypes[ebN,1]
7635  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
7636  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+
7637  * material_functions[material_right](x[ebN,k],t))
7638  */
7639  __pyx_t_9 = (__pyx_v_x->dimensions[1]);
7640  __pyx_t_10 = __pyx_t_9;
7641  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
7642  __pyx_v_k = __pyx_t_11;
7643 
7644  /* "subsurfaceTransportFunctions.pyx":267
7645  * material_right= elementBoundaryTypes[ebN,1]
7646  * for k in range(x.shape[1]):
7647  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+ # <<<<<<<<<<<<<<
7648  * material_functions[material_right](x[ebN,k],t))
7649  *
7650  */
7651  if (unlikely(__pyx_v_material_functions == Py_None)) {
7652  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7653  __PYX_ERR(0, 267, __pyx_L1_error)
7654  }
7655  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 267, __pyx_L1_error)
7656  __Pyx_GOTREF(__pyx_t_13);
7657  __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 267, __pyx_L1_error)
7658  __Pyx_GOTREF(__pyx_t_14);
7659  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7660  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 267, __pyx_L1_error)
7661  __Pyx_GOTREF(__pyx_t_13);
7662  __pyx_t_15 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_k); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 267, __pyx_L1_error)
7663  __Pyx_GOTREF(__pyx_t_15);
7664  __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 267, __pyx_L1_error)
7665  __Pyx_GOTREF(__pyx_t_16);
7666  __Pyx_GIVEREF(__pyx_t_13);
7667  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_13);
7668  __Pyx_GIVEREF(__pyx_t_15);
7669  PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_15);
7670  __pyx_t_13 = 0;
7671  __pyx_t_15 = 0;
7672  __pyx_t_15 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 267, __pyx_L1_error)
7673  __Pyx_GOTREF(__pyx_t_15);
7674  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7675  __pyx_t_16 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 267, __pyx_L1_error)
7676  __Pyx_GOTREF(__pyx_t_16);
7677  __pyx_t_13 = NULL;
7678  __pyx_t_6 = 0;
7679  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
7680  __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_14);
7681  if (likely(__pyx_t_13)) {
7682  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
7683  __Pyx_INCREF(__pyx_t_13);
7684  __Pyx_INCREF(function);
7685  __Pyx_DECREF_SET(__pyx_t_14, function);
7686  __pyx_t_6 = 1;
7687  }
7688  }
7689  #if CYTHON_FAST_PYCALL
7690  if (PyFunction_Check(__pyx_t_14)) {
7691  PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_t_15, __pyx_t_16};
7692  __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 267, __pyx_L1_error)
7693  __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
7694  __Pyx_GOTREF(__pyx_t_12);
7695  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7696  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7697  } else
7698  #endif
7699  #if CYTHON_FAST_PYCCALL
7700  if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
7701  PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_t_15, __pyx_t_16};
7702  __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 267, __pyx_L1_error)
7703  __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
7704  __Pyx_GOTREF(__pyx_t_12);
7705  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7706  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7707  } else
7708  #endif
7709  {
7710  __pyx_t_17 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 267, __pyx_L1_error)
7711  __Pyx_GOTREF(__pyx_t_17);
7712  if (__pyx_t_13) {
7713  __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_13); __pyx_t_13 = NULL;
7714  }
7715  __Pyx_GIVEREF(__pyx_t_15);
7716  PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_6, __pyx_t_15);
7717  __Pyx_GIVEREF(__pyx_t_16);
7718  PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_6, __pyx_t_16);
7719  __pyx_t_15 = 0;
7720  __pyx_t_16 = 0;
7721  __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_17, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 267, __pyx_L1_error)
7722  __Pyx_GOTREF(__pyx_t_12);
7723  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
7724  }
7725  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7726 
7727  /* "subsurfaceTransportFunctions.pyx":268
7728  * for k in range(x.shape[1]):
7729  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+
7730  * material_functions[material_right](x[ebN,k],t)) # <<<<<<<<<<<<<<
7731  *
7732  *
7733  */
7734  if (unlikely(__pyx_v_material_functions == Py_None)) {
7735  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7736  __PYX_ERR(0, 268, __pyx_L1_error)
7737  }
7738  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 268, __pyx_L1_error)
7739  __Pyx_GOTREF(__pyx_t_17);
7740  __pyx_t_16 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 268, __pyx_L1_error)
7741  __Pyx_GOTREF(__pyx_t_16);
7742  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
7743  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 268, __pyx_L1_error)
7744  __Pyx_GOTREF(__pyx_t_17);
7745  __pyx_t_15 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_k); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 268, __pyx_L1_error)
7746  __Pyx_GOTREF(__pyx_t_15);
7747  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 268, __pyx_L1_error)
7748  __Pyx_GOTREF(__pyx_t_13);
7749  __Pyx_GIVEREF(__pyx_t_17);
7750  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_17);
7751  __Pyx_GIVEREF(__pyx_t_15);
7752  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_15);
7753  __pyx_t_17 = 0;
7754  __pyx_t_15 = 0;
7755  __pyx_t_15 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_13); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 268, __pyx_L1_error)
7756  __Pyx_GOTREF(__pyx_t_15);
7757  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7758  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 268, __pyx_L1_error)
7759  __Pyx_GOTREF(__pyx_t_13);
7760  __pyx_t_17 = NULL;
7761  __pyx_t_6 = 0;
7762  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
7763  __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_16);
7764  if (likely(__pyx_t_17)) {
7765  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
7766  __Pyx_INCREF(__pyx_t_17);
7767  __Pyx_INCREF(function);
7768  __Pyx_DECREF_SET(__pyx_t_16, function);
7769  __pyx_t_6 = 1;
7770  }
7771  }
7772  #if CYTHON_FAST_PYCALL
7773  if (PyFunction_Check(__pyx_t_16)) {
7774  PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_15, __pyx_t_13};
7775  __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 268, __pyx_L1_error)
7776  __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
7777  __Pyx_GOTREF(__pyx_t_14);
7778  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7779  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7780  } else
7781  #endif
7782  #if CYTHON_FAST_PYCCALL
7783  if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
7784  PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_15, __pyx_t_13};
7785  __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 268, __pyx_L1_error)
7786  __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
7787  __Pyx_GOTREF(__pyx_t_14);
7788  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7789  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7790  } else
7791  #endif
7792  {
7793  __pyx_t_18 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 268, __pyx_L1_error)
7794  __Pyx_GOTREF(__pyx_t_18);
7795  if (__pyx_t_17) {
7796  __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_17); __pyx_t_17 = NULL;
7797  }
7798  __Pyx_GIVEREF(__pyx_t_15);
7799  PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_6, __pyx_t_15);
7800  __Pyx_GIVEREF(__pyx_t_13);
7801  PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_6, __pyx_t_13);
7802  __pyx_t_15 = 0;
7803  __pyx_t_13 = 0;
7804  __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_18, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 268, __pyx_L1_error)
7805  __Pyx_GOTREF(__pyx_t_14);
7806  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
7807  }
7808  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7809 
7810  /* "subsurfaceTransportFunctions.pyx":267
7811  * material_right= elementBoundaryTypes[ebN,1]
7812  * for k in range(x.shape[1]):
7813  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+ # <<<<<<<<<<<<<<
7814  * material_functions[material_right](x[ebN,k],t))
7815  *
7816  */
7817  __pyx_t_16 = PyNumber_Add(__pyx_t_12, __pyx_t_14); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 267, __pyx_L1_error)
7818  __Pyx_GOTREF(__pyx_t_16);
7819  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
7820  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7821  __pyx_t_14 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_16); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 267, __pyx_L1_error)
7822  __Pyx_GOTREF(__pyx_t_14);
7823  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7824  __pyx_t_19 = __pyx_PyFloat_AsDouble(__pyx_t_14); if (unlikely((__pyx_t_19 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 267, __pyx_L1_error)
7825  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7826  __pyx_t_20 = __pyx_v_ebN;
7827  __pyx_t_21 = __pyx_v_k;
7828  __pyx_t_6 = -1;
7829  if (__pyx_t_20 < 0) {
7830  __pyx_t_20 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
7831  if (unlikely(__pyx_t_20 < 0)) __pyx_t_6 = 0;
7832  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_6 = 0;
7833  if (__pyx_t_21 < 0) {
7834  __pyx_t_21 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
7835  if (unlikely(__pyx_t_21 < 0)) __pyx_t_6 = 1;
7836  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_6 = 1;
7837  if (unlikely(__pyx_t_6 != -1)) {
7838  __Pyx_RaiseBufferIndexError(__pyx_t_6);
7839  __PYX_ERR(0, 267, __pyx_L1_error)
7840  }
7841  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides) = __pyx_t_19;
7842  }
7843  }
7844 
7845  /* "subsurfaceTransportFunctions.pyx":248
7846  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
7847  *
7848  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
7849  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
7850  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
7851  */
7852 
7853  /* function exit code */
7854  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7855  goto __pyx_L0;
7856  __pyx_L1_error:;
7857  __Pyx_XDECREF(__pyx_t_12);
7858  __Pyx_XDECREF(__pyx_t_13);
7859  __Pyx_XDECREF(__pyx_t_14);
7860  __Pyx_XDECREF(__pyx_t_15);
7861  __Pyx_XDECREF(__pyx_t_16);
7862  __Pyx_XDECREF(__pyx_t_17);
7863  __Pyx_XDECREF(__pyx_t_18);
7864  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
7865  __Pyx_PyThreadState_declare
7866  __Pyx_PyThreadState_assign
7867  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
7868  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
7869  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
7870  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
7871  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7872  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
7873  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
7874  __pyx_r = NULL;
7875  goto __pyx_L2;
7876  __pyx_L0:;
7877  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
7878  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
7879  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
7880  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7881  __pyx_L2:;
7882  __Pyx_XGIVEREF(__pyx_r);
7883  __Pyx_RefNannyFinishContext();
7884  return __pyx_r;
7885 }
7886 
7887 /* "subsurfaceTransportFunctions.pyx":271
7888  *
7889  *
7890  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
7891  * double t,
7892  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
7893  */
7894 
7895 /* Python wrapper */
7896 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7897 static char __pyx_doc_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn}(x,t) = f^L_{j,mn}(x,t)f^R_{k,mn}(x,t)/(f^L_{j,mn}(x,t)+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
7898 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage = {"evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage};
7899 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7900  int __pyx_v_nd;
7901  double __pyx_v_t;
7902  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
7903  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
7904  PyArrayObject *__pyx_v_x = 0;
7905  PyArrayObject *__pyx_v_ebq_global_vals = 0;
7906  PyObject *__pyx_v_material_functions = 0;
7907  PyObject *__pyx_r = 0;
7908  __Pyx_RefNannyDeclarations
7909  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage (wrapper)", 0);
7910  {
7911  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
7912  PyObject* values[7] = {0,0,0,0,0,0,0};
7913  if (unlikely(__pyx_kwds)) {
7914  Py_ssize_t kw_args;
7915  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7916  switch (pos_args) {
7917  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
7918  CYTHON_FALLTHROUGH;
7919  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7920  CYTHON_FALLTHROUGH;
7921  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7922  CYTHON_FALLTHROUGH;
7923  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7924  CYTHON_FALLTHROUGH;
7925  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7926  CYTHON_FALLTHROUGH;
7927  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7928  CYTHON_FALLTHROUGH;
7929  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7930  CYTHON_FALLTHROUGH;
7931  case 0: break;
7932  default: goto __pyx_L5_argtuple_error;
7933  }
7934  kw_args = PyDict_Size(__pyx_kwds);
7935  switch (pos_args) {
7936  case 0:
7937  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
7938  else goto __pyx_L5_argtuple_error;
7939  CYTHON_FALLTHROUGH;
7940  case 1:
7941  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
7942  else {
7943  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 1); __PYX_ERR(0, 271, __pyx_L3_error)
7944  }
7945  CYTHON_FALLTHROUGH;
7946  case 2:
7947  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
7948  else {
7949  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 2); __PYX_ERR(0, 271, __pyx_L3_error)
7950  }
7951  CYTHON_FALLTHROUGH;
7952  case 3:
7953  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
7954  else {
7955  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 3); __PYX_ERR(0, 271, __pyx_L3_error)
7956  }
7957  CYTHON_FALLTHROUGH;
7958  case 4:
7959  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
7960  else {
7961  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 4); __PYX_ERR(0, 271, __pyx_L3_error)
7962  }
7963  CYTHON_FALLTHROUGH;
7964  case 5:
7965  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
7966  else {
7967  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 5); __PYX_ERR(0, 271, __pyx_L3_error)
7968  }
7969  CYTHON_FALLTHROUGH;
7970  case 6:
7971  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
7972  else {
7973  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 6); __PYX_ERR(0, 271, __pyx_L3_error)
7974  }
7975  }
7976  if (unlikely(kw_args > 0)) {
7977  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage") < 0)) __PYX_ERR(0, 271, __pyx_L3_error)
7978  }
7979  } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
7980  goto __pyx_L5_argtuple_error;
7981  } else {
7982  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7983  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7984  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7985  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7986  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7987  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7988  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
7989  }
7990  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 271, __pyx_L3_error)
7991  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 272, __pyx_L3_error)
7992  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[2]);
7993  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[3]);
7994  __pyx_v_x = ((PyArrayObject *)values[4]);
7995  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[5]);
7996  __pyx_v_material_functions = ((PyObject*)values[6]);
7997  }
7998  goto __pyx_L4_argument_unpacking_done;
7999  __pyx_L5_argtuple_error:;
8000  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 271, __pyx_L3_error)
8001  __pyx_L3_error:;
8002  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
8003  __Pyx_RefNannyFinishContext();
8004  return NULL;
8005  __pyx_L4_argument_unpacking_done:;
8006  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 273, __pyx_L1_error)
8007  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 274, __pyx_L1_error)
8008  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 275, __pyx_L1_error)
8009  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) __PYX_ERR(0, 276, __pyx_L1_error)
8010  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 277, __pyx_L1_error)
8011  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
8012 
8013  /* function exit code */
8014  goto __pyx_L0;
8015  __pyx_L1_error:;
8016  __pyx_r = NULL;
8017  __pyx_L0:;
8018  __Pyx_RefNannyFinishContext();
8019  return __pyx_r;
8020 }
8021 
8022 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
8023  int __pyx_v_ebN;
8024  int __pyx_v_k;
8025  int __pyx_v_material_left;
8026  int __pyx_v_material_right;
8027  int __pyx_v_I;
8028  int __pyx_v_J;
8029  double __pyx_v_numer;
8030  double __pyx_v_denom;
8031  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
8032  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
8033  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
8034  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
8035  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
8036  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
8037  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
8038  __Pyx_Buffer __pyx_pybuffer_x;
8039  PyObject *__pyx_r = NULL;
8040  __Pyx_RefNannyDeclarations
8041  npy_intp __pyx_t_1;
8042  npy_intp __pyx_t_2;
8043  int __pyx_t_3;
8044  Py_ssize_t __pyx_t_4;
8045  Py_ssize_t __pyx_t_5;
8046  int __pyx_t_6;
8047  Py_ssize_t __pyx_t_7;
8048  Py_ssize_t __pyx_t_8;
8049  npy_intp __pyx_t_9;
8050  npy_intp __pyx_t_10;
8051  int __pyx_t_11;
8052  int __pyx_t_12;
8053  int __pyx_t_13;
8054  int __pyx_t_14;
8055  int __pyx_t_15;
8056  int __pyx_t_16;
8057  PyObject *__pyx_t_17 = NULL;
8058  PyObject *__pyx_t_18 = NULL;
8059  PyObject *__pyx_t_19 = NULL;
8060  PyObject *__pyx_t_20 = NULL;
8061  PyObject *__pyx_t_21 = NULL;
8062  int __pyx_t_22;
8063  PyObject *__pyx_t_23 = NULL;
8064  PyObject *__pyx_t_24 = NULL;
8065  double __pyx_t_25;
8066  Py_ssize_t __pyx_t_26;
8067  Py_ssize_t __pyx_t_27;
8068  Py_ssize_t __pyx_t_28;
8069  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 0);
8070  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
8071  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
8072  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
8073  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
8074  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
8075  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
8076  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
8077  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
8078  __pyx_pybuffer_x.pybuffer.buf = NULL;
8079  __pyx_pybuffer_x.refcount = 0;
8080  __pyx_pybuffernd_x.data = NULL;
8081  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
8082  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
8083  __pyx_pybuffer_ebq_global_vals.refcount = 0;
8084  __pyx_pybuffernd_ebq_global_vals.data = NULL;
8085  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
8086  {
8087  __Pyx_BufFmt_StackElem __pyx_stack[1];
8088  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 271, __pyx_L1_error)
8089  }
8090  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
8091  {
8092  __Pyx_BufFmt_StackElem __pyx_stack[1];
8093  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 271, __pyx_L1_error)
8094  }
8095  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
8096  {
8097  __Pyx_BufFmt_StackElem __pyx_stack[1];
8098  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 271, __pyx_L1_error)
8099  }
8100  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
8101  {
8102  __Pyx_BufFmt_StackElem __pyx_stack[1];
8103  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 271, __pyx_L1_error)
8104  }
8105  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[2];
8106 
8107  /* "subsurfaceTransportFunctions.pyx":288
8108  * cdef double numer,denom
8109  *
8110  * for ebN in range(x.shape[0]): # <<<<<<<<<<<<<<
8111  * material_left = elementBoundaryTypes[ebN,0]
8112  * material_right= elementBoundaryTypes[ebN,1]
8113  */
8114  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
8115  __pyx_t_2 = __pyx_t_1;
8116  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
8117  __pyx_v_ebN = __pyx_t_3;
8118 
8119  /* "subsurfaceTransportFunctions.pyx":289
8120  *
8121  * for ebN in range(x.shape[0]):
8122  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
8123  * material_right= elementBoundaryTypes[ebN,1]
8124  * for k in range(x.shape[1]):
8125  */
8126  __pyx_t_4 = __pyx_v_ebN;
8127  __pyx_t_5 = 0;
8128  __pyx_t_6 = -1;
8129  if (__pyx_t_4 < 0) {
8130  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
8131  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
8132  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
8133  if (__pyx_t_5 < 0) {
8134  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
8135  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
8136  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
8137  if (unlikely(__pyx_t_6 != -1)) {
8138  __Pyx_RaiseBufferIndexError(__pyx_t_6);
8139  __PYX_ERR(0, 289, __pyx_L1_error)
8140  }
8141  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
8142 
8143  /* "subsurfaceTransportFunctions.pyx":290
8144  * for ebN in range(x.shape[0]):
8145  * material_left = elementBoundaryTypes[ebN,0]
8146  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
8147  * for k in range(x.shape[1]):
8148  * for I in range(nd):
8149  */
8150  __pyx_t_7 = __pyx_v_ebN;
8151  __pyx_t_8 = 1;
8152  __pyx_t_6 = -1;
8153  if (__pyx_t_7 < 0) {
8154  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
8155  if (unlikely(__pyx_t_7 < 0)) __pyx_t_6 = 0;
8156  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
8157  if (__pyx_t_8 < 0) {
8158  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
8159  if (unlikely(__pyx_t_8 < 0)) __pyx_t_6 = 1;
8160  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
8161  if (unlikely(__pyx_t_6 != -1)) {
8162  __Pyx_RaiseBufferIndexError(__pyx_t_6);
8163  __PYX_ERR(0, 290, __pyx_L1_error)
8164  }
8165  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
8166 
8167  /* "subsurfaceTransportFunctions.pyx":291
8168  * material_left = elementBoundaryTypes[ebN,0]
8169  * material_right= elementBoundaryTypes[ebN,1]
8170  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
8171  * for I in range(nd):
8172  * for J in range(nd):
8173  */
8174  __pyx_t_9 = (__pyx_v_x->dimensions[1]);
8175  __pyx_t_10 = __pyx_t_9;
8176  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_10; __pyx_t_6+=1) {
8177  __pyx_v_k = __pyx_t_6;
8178 
8179  /* "subsurfaceTransportFunctions.pyx":292
8180  * material_right= elementBoundaryTypes[ebN,1]
8181  * for k in range(x.shape[1]):
8182  * for I in range(nd): # <<<<<<<<<<<<<<
8183  * for J in range(nd):
8184  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
8185  */
8186  __pyx_t_11 = __pyx_v_nd;
8187  __pyx_t_12 = __pyx_t_11;
8188  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
8189  __pyx_v_I = __pyx_t_13;
8190 
8191  /* "subsurfaceTransportFunctions.pyx":293
8192  * for k in range(x.shape[1]):
8193  * for I in range(nd):
8194  * for J in range(nd): # <<<<<<<<<<<<<<
8195  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
8196  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20
8197  */
8198  __pyx_t_14 = __pyx_v_nd;
8199  __pyx_t_15 = __pyx_t_14;
8200  for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
8201  __pyx_v_J = __pyx_t_16;
8202 
8203  /* "subsurfaceTransportFunctions.pyx":294
8204  * for I in range(nd):
8205  * for J in range(nd):
8206  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J] # <<<<<<<<<<<<<<
8207  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20
8208  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
8209  */
8210  if (unlikely(__pyx_v_material_functions == Py_None)) {
8211  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8212  __PYX_ERR(0, 294, __pyx_L1_error)
8213  }
8214  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 294, __pyx_L1_error)
8215  __Pyx_GOTREF(__pyx_t_18);
8216  __pyx_t_19 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_18); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
8217  __Pyx_GOTREF(__pyx_t_19);
8218  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8219  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 294, __pyx_L1_error)
8220  __Pyx_GOTREF(__pyx_t_18);
8221  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 294, __pyx_L1_error)
8222  __Pyx_GOTREF(__pyx_t_20);
8223  __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8224  __Pyx_GOTREF(__pyx_t_21);
8225  __Pyx_GIVEREF(__pyx_t_18);
8226  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_18);
8227  __Pyx_GIVEREF(__pyx_t_20);
8228  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_20);
8229  __pyx_t_18 = 0;
8230  __pyx_t_20 = 0;
8231  __pyx_t_20 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_21); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 294, __pyx_L1_error)
8232  __Pyx_GOTREF(__pyx_t_20);
8233  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8234  __pyx_t_21 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8235  __Pyx_GOTREF(__pyx_t_21);
8236  __pyx_t_18 = NULL;
8237  __pyx_t_22 = 0;
8238  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) {
8239  __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_19);
8240  if (likely(__pyx_t_18)) {
8241  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19);
8242  __Pyx_INCREF(__pyx_t_18);
8243  __Pyx_INCREF(function);
8244  __Pyx_DECREF_SET(__pyx_t_19, function);
8245  __pyx_t_22 = 1;
8246  }
8247  }
8248  #if CYTHON_FAST_PYCALL
8249  if (PyFunction_Check(__pyx_t_19)) {
8250  PyObject *__pyx_temp[3] = {__pyx_t_18, __pyx_t_20, __pyx_t_21};
8251  __pyx_t_17 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
8252  __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
8253  __Pyx_GOTREF(__pyx_t_17);
8254  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
8255  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8256  } else
8257  #endif
8258  #if CYTHON_FAST_PYCCALL
8259  if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) {
8260  PyObject *__pyx_temp[3] = {__pyx_t_18, __pyx_t_20, __pyx_t_21};
8261  __pyx_t_17 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
8262  __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
8263  __Pyx_GOTREF(__pyx_t_17);
8264  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
8265  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8266  } else
8267  #endif
8268  {
8269  __pyx_t_23 = PyTuple_New(2+__pyx_t_22); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 294, __pyx_L1_error)
8270  __Pyx_GOTREF(__pyx_t_23);
8271  if (__pyx_t_18) {
8272  __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_18); __pyx_t_18 = NULL;
8273  }
8274  __Pyx_GIVEREF(__pyx_t_20);
8275  PyTuple_SET_ITEM(__pyx_t_23, 0+__pyx_t_22, __pyx_t_20);
8276  __Pyx_GIVEREF(__pyx_t_21);
8277  PyTuple_SET_ITEM(__pyx_t_23, 1+__pyx_t_22, __pyx_t_21);
8278  __pyx_t_20 = 0;
8279  __pyx_t_21 = 0;
8280  __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_23, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
8281  __Pyx_GOTREF(__pyx_t_17);
8282  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
8283  }
8284  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8285  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
8286  __Pyx_GOTREF(__pyx_t_19);
8287  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 294, __pyx_L1_error)
8288  __Pyx_GOTREF(__pyx_t_23);
8289  __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8290  __Pyx_GOTREF(__pyx_t_21);
8291  __Pyx_GIVEREF(__pyx_t_19);
8292  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_19);
8293  __Pyx_GIVEREF(__pyx_t_23);
8294  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_23);
8295  __pyx_t_19 = 0;
8296  __pyx_t_23 = 0;
8297  __pyx_t_23 = __Pyx_PyObject_GetItem(__pyx_t_17, __pyx_t_21); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 294, __pyx_L1_error)
8298  __Pyx_GOTREF(__pyx_t_23);
8299  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8300  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8301  __pyx_t_21 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_23); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8302  __Pyx_GOTREF(__pyx_t_21);
8303  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
8304  if (unlikely(__pyx_v_material_functions == Py_None)) {
8305  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8306  __PYX_ERR(0, 294, __pyx_L1_error)
8307  }
8308  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
8309  __Pyx_GOTREF(__pyx_t_17);
8310  __pyx_t_19 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_17); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
8311  __Pyx_GOTREF(__pyx_t_19);
8312  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8313  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
8314  __Pyx_GOTREF(__pyx_t_17);
8315  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 294, __pyx_L1_error)
8316  __Pyx_GOTREF(__pyx_t_20);
8317  __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 294, __pyx_L1_error)
8318  __Pyx_GOTREF(__pyx_t_18);
8319  __Pyx_GIVEREF(__pyx_t_17);
8320  PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_17);
8321  __Pyx_GIVEREF(__pyx_t_20);
8322  PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_20);
8323  __pyx_t_17 = 0;
8324  __pyx_t_20 = 0;
8325  __pyx_t_20 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_18); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 294, __pyx_L1_error)
8326  __Pyx_GOTREF(__pyx_t_20);
8327  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8328  __pyx_t_18 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 294, __pyx_L1_error)
8329  __Pyx_GOTREF(__pyx_t_18);
8330  __pyx_t_17 = NULL;
8331  __pyx_t_22 = 0;
8332  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) {
8333  __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_19);
8334  if (likely(__pyx_t_17)) {
8335  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19);
8336  __Pyx_INCREF(__pyx_t_17);
8337  __Pyx_INCREF(function);
8338  __Pyx_DECREF_SET(__pyx_t_19, function);
8339  __pyx_t_22 = 1;
8340  }
8341  }
8342  #if CYTHON_FAST_PYCALL
8343  if (PyFunction_Check(__pyx_t_19)) {
8344  PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_20, __pyx_t_18};
8345  __pyx_t_23 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 294, __pyx_L1_error)
8346  __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
8347  __Pyx_GOTREF(__pyx_t_23);
8348  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
8349  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8350  } else
8351  #endif
8352  #if CYTHON_FAST_PYCCALL
8353  if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) {
8354  PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_20, __pyx_t_18};
8355  __pyx_t_23 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 294, __pyx_L1_error)
8356  __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
8357  __Pyx_GOTREF(__pyx_t_23);
8358  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
8359  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8360  } else
8361  #endif
8362  {
8363  __pyx_t_24 = PyTuple_New(2+__pyx_t_22); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 294, __pyx_L1_error)
8364  __Pyx_GOTREF(__pyx_t_24);
8365  if (__pyx_t_17) {
8366  __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_17); __pyx_t_17 = NULL;
8367  }
8368  __Pyx_GIVEREF(__pyx_t_20);
8369  PyTuple_SET_ITEM(__pyx_t_24, 0+__pyx_t_22, __pyx_t_20);
8370  __Pyx_GIVEREF(__pyx_t_18);
8371  PyTuple_SET_ITEM(__pyx_t_24, 1+__pyx_t_22, __pyx_t_18);
8372  __pyx_t_20 = 0;
8373  __pyx_t_18 = 0;
8374  __pyx_t_23 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_24, NULL); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 294, __pyx_L1_error)
8375  __Pyx_GOTREF(__pyx_t_23);
8376  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
8377  }
8378  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8379  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
8380  __Pyx_GOTREF(__pyx_t_19);
8381  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 294, __pyx_L1_error)
8382  __Pyx_GOTREF(__pyx_t_24);
8383  __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 294, __pyx_L1_error)
8384  __Pyx_GOTREF(__pyx_t_18);
8385  __Pyx_GIVEREF(__pyx_t_19);
8386  PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_19);
8387  __Pyx_GIVEREF(__pyx_t_24);
8388  PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_24);
8389  __pyx_t_19 = 0;
8390  __pyx_t_24 = 0;
8391  __pyx_t_24 = __Pyx_PyObject_GetItem(__pyx_t_23, __pyx_t_18); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 294, __pyx_L1_error)
8392  __Pyx_GOTREF(__pyx_t_24);
8393  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
8394  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8395  __pyx_t_18 = PyNumber_Multiply(__pyx_t_21, __pyx_t_24); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 294, __pyx_L1_error)
8396  __Pyx_GOTREF(__pyx_t_18);
8397  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8398  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
8399  __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_t_18); if (unlikely((__pyx_t_25 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 294, __pyx_L1_error)
8400  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8401  __pyx_v_numer = __pyx_t_25;
8402 
8403  /* "subsurfaceTransportFunctions.pyx":295
8404  * for J in range(nd):
8405  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
8406  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20 # <<<<<<<<<<<<<<
8407  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
8408  *
8409  */
8410  if (unlikely(__pyx_v_material_functions == Py_None)) {
8411  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8412  __PYX_ERR(0, 295, __pyx_L1_error)
8413  }
8414  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 295, __pyx_L1_error)
8415  __Pyx_GOTREF(__pyx_t_24);
8416  __pyx_t_21 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_24); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 295, __pyx_L1_error)
8417  __Pyx_GOTREF(__pyx_t_21);
8418  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
8419  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 295, __pyx_L1_error)
8420  __Pyx_GOTREF(__pyx_t_24);
8421  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 295, __pyx_L1_error)
8422  __Pyx_GOTREF(__pyx_t_23);
8423  __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8424  __Pyx_GOTREF(__pyx_t_19);
8425  __Pyx_GIVEREF(__pyx_t_24);
8426  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_24);
8427  __Pyx_GIVEREF(__pyx_t_23);
8428  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_23);
8429  __pyx_t_24 = 0;
8430  __pyx_t_23 = 0;
8431  __pyx_t_23 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_19); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 295, __pyx_L1_error)
8432  __Pyx_GOTREF(__pyx_t_23);
8433  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8434  __pyx_t_19 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8435  __Pyx_GOTREF(__pyx_t_19);
8436  __pyx_t_24 = NULL;
8437  __pyx_t_22 = 0;
8438  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_21))) {
8439  __pyx_t_24 = PyMethod_GET_SELF(__pyx_t_21);
8440  if (likely(__pyx_t_24)) {
8441  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21);
8442  __Pyx_INCREF(__pyx_t_24);
8443  __Pyx_INCREF(function);
8444  __Pyx_DECREF_SET(__pyx_t_21, function);
8445  __pyx_t_22 = 1;
8446  }
8447  }
8448  #if CYTHON_FAST_PYCALL
8449  if (PyFunction_Check(__pyx_t_21)) {
8450  PyObject *__pyx_temp[3] = {__pyx_t_24, __pyx_t_23, __pyx_t_19};
8451  __pyx_t_18 = __Pyx_PyFunction_FastCall(__pyx_t_21, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 295, __pyx_L1_error)
8452  __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
8453  __Pyx_GOTREF(__pyx_t_18);
8454  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
8455  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8456  } else
8457  #endif
8458  #if CYTHON_FAST_PYCCALL
8459  if (__Pyx_PyFastCFunction_Check(__pyx_t_21)) {
8460  PyObject *__pyx_temp[3] = {__pyx_t_24, __pyx_t_23, __pyx_t_19};
8461  __pyx_t_18 = __Pyx_PyCFunction_FastCall(__pyx_t_21, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 295, __pyx_L1_error)
8462  __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
8463  __Pyx_GOTREF(__pyx_t_18);
8464  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
8465  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8466  } else
8467  #endif
8468  {
8469  __pyx_t_20 = PyTuple_New(2+__pyx_t_22); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 295, __pyx_L1_error)
8470  __Pyx_GOTREF(__pyx_t_20);
8471  if (__pyx_t_24) {
8472  __Pyx_GIVEREF(__pyx_t_24); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_24); __pyx_t_24 = NULL;
8473  }
8474  __Pyx_GIVEREF(__pyx_t_23);
8475  PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_22, __pyx_t_23);
8476  __Pyx_GIVEREF(__pyx_t_19);
8477  PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_22, __pyx_t_19);
8478  __pyx_t_23 = 0;
8479  __pyx_t_19 = 0;
8480  __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_21, __pyx_t_20, NULL); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 295, __pyx_L1_error)
8481  __Pyx_GOTREF(__pyx_t_18);
8482  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
8483  }
8484  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8485  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 295, __pyx_L1_error)
8486  __Pyx_GOTREF(__pyx_t_21);
8487  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 295, __pyx_L1_error)
8488  __Pyx_GOTREF(__pyx_t_20);
8489  __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8490  __Pyx_GOTREF(__pyx_t_19);
8491  __Pyx_GIVEREF(__pyx_t_21);
8492  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_21);
8493  __Pyx_GIVEREF(__pyx_t_20);
8494  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_20);
8495  __pyx_t_21 = 0;
8496  __pyx_t_20 = 0;
8497  __pyx_t_20 = __Pyx_PyObject_GetItem(__pyx_t_18, __pyx_t_19); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 295, __pyx_L1_error)
8498  __Pyx_GOTREF(__pyx_t_20);
8499  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8500  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8501  if (unlikely(__pyx_v_material_functions == Py_None)) {
8502  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8503  __PYX_ERR(0, 295, __pyx_L1_error)
8504  }
8505  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 295, __pyx_L1_error)
8506  __Pyx_GOTREF(__pyx_t_18);
8507  __pyx_t_21 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_18); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 295, __pyx_L1_error)
8508  __Pyx_GOTREF(__pyx_t_21);
8509  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8510  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 295, __pyx_L1_error)
8511  __Pyx_GOTREF(__pyx_t_18);
8512  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 295, __pyx_L1_error)
8513  __Pyx_GOTREF(__pyx_t_23);
8514  __pyx_t_24 = PyTuple_New(2); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 295, __pyx_L1_error)
8515  __Pyx_GOTREF(__pyx_t_24);
8516  __Pyx_GIVEREF(__pyx_t_18);
8517  PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_18);
8518  __Pyx_GIVEREF(__pyx_t_23);
8519  PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_23);
8520  __pyx_t_18 = 0;
8521  __pyx_t_23 = 0;
8522  __pyx_t_23 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_24); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 295, __pyx_L1_error)
8523  __Pyx_GOTREF(__pyx_t_23);
8524  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
8525  __pyx_t_24 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 295, __pyx_L1_error)
8526  __Pyx_GOTREF(__pyx_t_24);
8527  __pyx_t_18 = NULL;
8528  __pyx_t_22 = 0;
8529  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_21))) {
8530  __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_21);
8531  if (likely(__pyx_t_18)) {
8532  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21);
8533  __Pyx_INCREF(__pyx_t_18);
8534  __Pyx_INCREF(function);
8535  __Pyx_DECREF_SET(__pyx_t_21, function);
8536  __pyx_t_22 = 1;
8537  }
8538  }
8539  #if CYTHON_FAST_PYCALL
8540  if (PyFunction_Check(__pyx_t_21)) {
8541  PyObject *__pyx_temp[3] = {__pyx_t_18, __pyx_t_23, __pyx_t_24};
8542  __pyx_t_19 = __Pyx_PyFunction_FastCall(__pyx_t_21, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8543  __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
8544  __Pyx_GOTREF(__pyx_t_19);
8545  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
8546  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
8547  } else
8548  #endif
8549  #if CYTHON_FAST_PYCCALL
8550  if (__Pyx_PyFastCFunction_Check(__pyx_t_21)) {
8551  PyObject *__pyx_temp[3] = {__pyx_t_18, __pyx_t_23, __pyx_t_24};
8552  __pyx_t_19 = __Pyx_PyCFunction_FastCall(__pyx_t_21, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8553  __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
8554  __Pyx_GOTREF(__pyx_t_19);
8555  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
8556  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
8557  } else
8558  #endif
8559  {
8560  __pyx_t_17 = PyTuple_New(2+__pyx_t_22); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8561  __Pyx_GOTREF(__pyx_t_17);
8562  if (__pyx_t_18) {
8563  __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_18); __pyx_t_18 = NULL;
8564  }
8565  __Pyx_GIVEREF(__pyx_t_23);
8566  PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_22, __pyx_t_23);
8567  __Pyx_GIVEREF(__pyx_t_24);
8568  PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_22, __pyx_t_24);
8569  __pyx_t_23 = 0;
8570  __pyx_t_24 = 0;
8571  __pyx_t_19 = __Pyx_PyObject_Call(__pyx_t_21, __pyx_t_17, NULL); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8572  __Pyx_GOTREF(__pyx_t_19);
8573  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8574  }
8575  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8576  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 295, __pyx_L1_error)
8577  __Pyx_GOTREF(__pyx_t_21);
8578  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8579  __Pyx_GOTREF(__pyx_t_17);
8580  __pyx_t_24 = PyTuple_New(2); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 295, __pyx_L1_error)
8581  __Pyx_GOTREF(__pyx_t_24);
8582  __Pyx_GIVEREF(__pyx_t_21);
8583  PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_21);
8584  __Pyx_GIVEREF(__pyx_t_17);
8585  PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_17);
8586  __pyx_t_21 = 0;
8587  __pyx_t_17 = 0;
8588  __pyx_t_17 = __Pyx_PyObject_GetItem(__pyx_t_19, __pyx_t_24); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8589  __Pyx_GOTREF(__pyx_t_17);
8590  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8591  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
8592  __pyx_t_24 = PyNumber_Add(__pyx_t_20, __pyx_t_17); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 295, __pyx_L1_error)
8593  __Pyx_GOTREF(__pyx_t_24);
8594  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
8595  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8596  __pyx_t_17 = __Pyx_PyFloat_AddObjC(__pyx_t_24, __pyx_float_1_0eneg_20, 1.0e-20, 0, 0); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8597  __Pyx_GOTREF(__pyx_t_17);
8598  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
8599  __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_t_17); if (unlikely((__pyx_t_25 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 295, __pyx_L1_error)
8600  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8601  __pyx_v_denom = __pyx_t_25;
8602 
8603  /* "subsurfaceTransportFunctions.pyx":296
8604  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
8605  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20
8606  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
8607  *
8608  *
8609  */
8610  if (unlikely(__pyx_v_denom == 0)) {
8611  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
8612  __PYX_ERR(0, 296, __pyx_L1_error)
8613  }
8614  __pyx_t_26 = __pyx_v_ebN;
8615  __pyx_t_27 = __pyx_v_k;
8616  __pyx_t_28 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
8617  __pyx_t_22 = -1;
8618  if (__pyx_t_26 < 0) {
8619  __pyx_t_26 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
8620  if (unlikely(__pyx_t_26 < 0)) __pyx_t_22 = 0;
8621  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_22 = 0;
8622  if (__pyx_t_27 < 0) {
8623  __pyx_t_27 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
8624  if (unlikely(__pyx_t_27 < 0)) __pyx_t_22 = 1;
8625  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_22 = 1;
8626  if (__pyx_t_28 < 0) {
8627  __pyx_t_28 += __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape;
8628  if (unlikely(__pyx_t_28 < 0)) __pyx_t_22 = 2;
8629  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape)) __pyx_t_22 = 2;
8630  if (unlikely(__pyx_t_22 != -1)) {
8631  __Pyx_RaiseBufferIndexError(__pyx_t_22);
8632  __PYX_ERR(0, 296, __pyx_L1_error)
8633  }
8634  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides, __pyx_t_28, __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides) = (__pyx_v_numer / __pyx_v_denom);
8635  }
8636  }
8637  }
8638  }
8639 
8640  /* "subsurfaceTransportFunctions.pyx":271
8641  *
8642  *
8643  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
8644  * double t,
8645  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
8646  */
8647 
8648  /* function exit code */
8649  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8650  goto __pyx_L0;
8651  __pyx_L1_error:;
8652  __Pyx_XDECREF(__pyx_t_17);
8653  __Pyx_XDECREF(__pyx_t_18);
8654  __Pyx_XDECREF(__pyx_t_19);
8655  __Pyx_XDECREF(__pyx_t_20);
8656  __Pyx_XDECREF(__pyx_t_21);
8657  __Pyx_XDECREF(__pyx_t_23);
8658  __Pyx_XDECREF(__pyx_t_24);
8659  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
8660  __Pyx_PyThreadState_declare
8661  __Pyx_PyThreadState_assign
8662  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
8663  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
8664  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
8665  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
8666  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
8667  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
8668  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
8669  __pyx_r = NULL;
8670  goto __pyx_L2;
8671  __pyx_L0:;
8672  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
8673  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
8674  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
8675  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
8676  __pyx_L2:;
8677  __Pyx_XGIVEREF(__pyx_r);
8678  __Pyx_RefNannyFinishContext();
8679  return __pyx_r;
8680 }
8681 
8682 /* "subsurfaceTransportFunctions.pyx":301
8683  *
8684  * ##################################################
8685  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
8686  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
8687  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
8688  */
8689 
8690 /* Python wrapper */
8691 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8692 static char __pyx_doc_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear[] = "\n routine for evaluating linaer interface (nodal) coefficients in NCP1 approximation for Darcy Flow\n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n assumes slight compressiblity for now\n\n TODO:\n everything\n \n ";
8693 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear = {"RE_NCP1_evaluateElementCoefficients_Linear", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear};
8694 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8695  double __pyx_v_rho;
8696  PyArrayObject *__pyx_v_gravity = 0;
8697  PyArrayObject *__pyx_v_rowptr = 0;
8698  PyArrayObject *__pyx_v_colind = 0;
8699  PyArrayObject *__pyx_v_KWs = 0;
8700  int __pyx_v_nSpace;
8701  int __pyx_v_nElements_global;
8702  int __pyx_v_nElementBoundaries_element;
8703  PyArrayObject *__pyx_v_elementNeighborsArray = 0;
8704  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
8705  PyArrayObject *__pyx_v_q_flin = 0;
8706  PyArrayObject *__pyx_v_q_alin = 0;
8707  PyObject *__pyx_r = 0;
8708  __Pyx_RefNannyDeclarations
8709  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_Linear (wrapper)", 0);
8710  {
8711  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rho,&__pyx_n_s_gravity,&__pyx_n_s_rowptr,&__pyx_n_s_colind,&__pyx_n_s_KWs,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_q_flin,&__pyx_n_s_q_alin,0};
8712  PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
8713  if (unlikely(__pyx_kwds)) {
8714  Py_ssize_t kw_args;
8715  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8716  switch (pos_args) {
8717  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
8718  CYTHON_FALLTHROUGH;
8719  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
8720  CYTHON_FALLTHROUGH;
8721  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
8722  CYTHON_FALLTHROUGH;
8723  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
8724  CYTHON_FALLTHROUGH;
8725  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
8726  CYTHON_FALLTHROUGH;
8727  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
8728  CYTHON_FALLTHROUGH;
8729  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8730  CYTHON_FALLTHROUGH;
8731  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8732  CYTHON_FALLTHROUGH;
8733  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8734  CYTHON_FALLTHROUGH;
8735  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8736  CYTHON_FALLTHROUGH;
8737  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8738  CYTHON_FALLTHROUGH;
8739  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8740  CYTHON_FALLTHROUGH;
8741  case 0: break;
8742  default: goto __pyx_L5_argtuple_error;
8743  }
8744  kw_args = PyDict_Size(__pyx_kwds);
8745  switch (pos_args) {
8746  case 0:
8747  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rho)) != 0)) kw_args--;
8748  else goto __pyx_L5_argtuple_error;
8749  CYTHON_FALLTHROUGH;
8750  case 1:
8751  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
8752  else {
8753  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 1); __PYX_ERR(0, 301, __pyx_L3_error)
8754  }
8755  CYTHON_FALLTHROUGH;
8756  case 2:
8757  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
8758  else {
8759  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 2); __PYX_ERR(0, 301, __pyx_L3_error)
8760  }
8761  CYTHON_FALLTHROUGH;
8762  case 3:
8763  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
8764  else {
8765  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 3); __PYX_ERR(0, 301, __pyx_L3_error)
8766  }
8767  CYTHON_FALLTHROUGH;
8768  case 4:
8769  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_KWs)) != 0)) kw_args--;
8770  else {
8771  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 4); __PYX_ERR(0, 301, __pyx_L3_error)
8772  }
8773  CYTHON_FALLTHROUGH;
8774  case 5:
8775  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
8776  else {
8777  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 5); __PYX_ERR(0, 301, __pyx_L3_error)
8778  }
8779  CYTHON_FALLTHROUGH;
8780  case 6:
8781  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
8782  else {
8783  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 6); __PYX_ERR(0, 301, __pyx_L3_error)
8784  }
8785  CYTHON_FALLTHROUGH;
8786  case 7:
8787  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
8788  else {
8789  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 7); __PYX_ERR(0, 301, __pyx_L3_error)
8790  }
8791  CYTHON_FALLTHROUGH;
8792  case 8:
8793  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
8794  else {
8795  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 8); __PYX_ERR(0, 301, __pyx_L3_error)
8796  }
8797  CYTHON_FALLTHROUGH;
8798  case 9:
8799  if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
8800  else {
8801  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 9); __PYX_ERR(0, 301, __pyx_L3_error)
8802  }
8803  CYTHON_FALLTHROUGH;
8804  case 10:
8805  if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_flin)) != 0)) kw_args--;
8806  else {
8807  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 10); __PYX_ERR(0, 301, __pyx_L3_error)
8808  }
8809  CYTHON_FALLTHROUGH;
8810  case 11:
8811  if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_alin)) != 0)) kw_args--;
8812  else {
8813  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 11); __PYX_ERR(0, 301, __pyx_L3_error)
8814  }
8815  }
8816  if (unlikely(kw_args > 0)) {
8817  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_evaluateElementCoefficients_Linear") < 0)) __PYX_ERR(0, 301, __pyx_L3_error)
8818  }
8819  } else if (PyTuple_GET_SIZE(__pyx_args) != 12) {
8820  goto __pyx_L5_argtuple_error;
8821  } else {
8822  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8823  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8824  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8825  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8826  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8827  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8828  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
8829  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
8830  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
8831  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
8832  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
8833  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
8834  }
8835  __pyx_v_rho = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_rho == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 301, __pyx_L3_error)
8836  __pyx_v_gravity = ((PyArrayObject *)values[1]);
8837  __pyx_v_rowptr = ((PyArrayObject *)values[2]);
8838  __pyx_v_colind = ((PyArrayObject *)values[3]);
8839  __pyx_v_KWs = ((PyArrayObject *)values[4]);
8840  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L3_error)
8841  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L3_error)
8842  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 309, __pyx_L3_error)
8843  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[8]);
8844  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[9]);
8845  __pyx_v_q_flin = ((PyArrayObject *)values[10]);
8846  __pyx_v_q_alin = ((PyArrayObject *)values[11]);
8847  }
8848  goto __pyx_L4_argument_unpacking_done;
8849  __pyx_L5_argtuple_error:;
8850  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 301, __pyx_L3_error)
8851  __pyx_L3_error:;
8852  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_Linear", __pyx_clineno, __pyx_lineno, __pyx_filename);
8853  __Pyx_RefNannyFinishContext();
8854  return NULL;
8855  __pyx_L4_argument_unpacking_done:;
8856  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) __PYX_ERR(0, 302, __pyx_L1_error)
8857  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rowptr), __pyx_ptype_5numpy_ndarray, 1, "rowptr", 0))) __PYX_ERR(0, 303, __pyx_L1_error)
8858  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_colind), __pyx_ptype_5numpy_ndarray, 1, "colind", 0))) __PYX_ERR(0, 304, __pyx_L1_error)
8859  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_KWs), __pyx_ptype_5numpy_ndarray, 1, "KWs", 0))) __PYX_ERR(0, 305, __pyx_L1_error)
8860  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) __PYX_ERR(0, 310, __pyx_L1_error)
8861  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 311, __pyx_L1_error)
8862  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_flin), __pyx_ptype_5numpy_ndarray, 1, "q_flin", 0))) __PYX_ERR(0, 312, __pyx_L1_error)
8863  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_alin), __pyx_ptype_5numpy_ndarray, 1, "q_alin", 0))) __PYX_ERR(0, 313, __pyx_L1_error)
8864  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear(__pyx_self, __pyx_v_rho, __pyx_v_gravity, __pyx_v_rowptr, __pyx_v_colind, __pyx_v_KWs, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementMaterialTypes, __pyx_v_q_flin, __pyx_v_q_alin);
8865 
8866  /* function exit code */
8867  goto __pyx_L0;
8868  __pyx_L1_error:;
8869  __pyx_r = NULL;
8870  __pyx_L0:;
8871  __Pyx_RefNannyFinishContext();
8872  return __pyx_r;
8873 }
8874 
8875 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, PyArrayObject *__pyx_v_KWs, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin) {
8876  int __pyx_v_eN;
8877  int __pyx_v_eN_neighbor;
8878  int __pyx_v_ii;
8879  int __pyx_v_I;
8880  int __pyx_v_ebN;
8881  int __pyx_v_matID;
8882  int __pyx_v_matID_neig;
8883  CYTHON_UNUSED int __pyx_v_nSpace2;
8884  int __pyx_v_nnz;
8885  PyArrayObject *__pyx_v_a_eN = 0;
8886  PyArrayObject *__pyx_v_a_neig = 0;
8887  PyArrayObject *__pyx_v_a_avg = 0;
8888  __Pyx_LocalBuf_ND __pyx_pybuffernd_KWs;
8889  __Pyx_Buffer __pyx_pybuffer_KWs;
8890  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_avg;
8891  __Pyx_Buffer __pyx_pybuffer_a_avg;
8892  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_eN;
8893  __Pyx_Buffer __pyx_pybuffer_a_eN;
8894  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_neig;
8895  __Pyx_Buffer __pyx_pybuffer_a_neig;
8896  __Pyx_LocalBuf_ND __pyx_pybuffernd_colind;
8897  __Pyx_Buffer __pyx_pybuffer_colind;
8898  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
8899  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
8900  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
8901  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
8902  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
8903  __Pyx_Buffer __pyx_pybuffer_gravity;
8904  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_alin;
8905  __Pyx_Buffer __pyx_pybuffer_q_alin;
8906  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_flin;
8907  __Pyx_Buffer __pyx_pybuffer_q_flin;
8908  __Pyx_LocalBuf_ND __pyx_pybuffernd_rowptr;
8909  __Pyx_Buffer __pyx_pybuffer_rowptr;
8910  PyObject *__pyx_r = NULL;
8911  __Pyx_RefNannyDeclarations
8912  Py_ssize_t __pyx_t_1;
8913  int __pyx_t_2;
8914  PyObject *__pyx_t_3 = NULL;
8915  PyObject *__pyx_t_4 = NULL;
8916  PyObject *__pyx_t_5 = NULL;
8917  PyObject *__pyx_t_6 = NULL;
8918  PyObject *__pyx_t_7 = NULL;
8919  PyArrayObject *__pyx_t_8 = NULL;
8920  PyArrayObject *__pyx_t_9 = NULL;
8921  PyArrayObject *__pyx_t_10 = NULL;
8922  int __pyx_t_11;
8923  int __pyx_t_12;
8924  Py_ssize_t __pyx_t_13;
8925  int __pyx_t_14;
8926  int __pyx_t_15;
8927  int __pyx_t_16;
8928  Py_ssize_t __pyx_t_17;
8929  Py_ssize_t __pyx_t_18;
8930  int __pyx_t_19;
8931  Py_ssize_t __pyx_t_20;
8932  Py_ssize_t __pyx_t_21;
8933  Py_ssize_t __pyx_t_22;
8934  int __pyx_t_23;
8935  int __pyx_t_24;
8936  Py_ssize_t __pyx_t_25;
8937  int __pyx_t_26;
8938  Py_ssize_t __pyx_t_27;
8939  int __pyx_t_28;
8940  Py_ssize_t __pyx_t_29;
8941  Py_ssize_t __pyx_t_30;
8942  Py_ssize_t __pyx_t_31;
8943  Py_ssize_t __pyx_t_32;
8944  Py_ssize_t __pyx_t_33;
8945  Py_ssize_t __pyx_t_34;
8946  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_35;
8947  Py_ssize_t __pyx_t_36;
8948  Py_ssize_t __pyx_t_37;
8949  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_38;
8950  Py_ssize_t __pyx_t_39;
8951  Py_ssize_t __pyx_t_40;
8952  Py_ssize_t __pyx_t_41;
8953  Py_ssize_t __pyx_t_42;
8954  Py_ssize_t __pyx_t_43;
8955  Py_ssize_t __pyx_t_44;
8956  Py_ssize_t __pyx_t_45;
8957  Py_ssize_t __pyx_t_46;
8958  Py_ssize_t __pyx_t_47;
8959  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_48;
8960  Py_ssize_t __pyx_t_49;
8961  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_50;
8962  Py_ssize_t __pyx_t_51;
8963  int __pyx_t_52;
8964  Py_ssize_t __pyx_t_53;
8965  Py_ssize_t __pyx_t_54;
8966  Py_ssize_t __pyx_t_55;
8967  Py_ssize_t __pyx_t_56;
8968  Py_ssize_t __pyx_t_57;
8969  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_Linear", 0);
8970  __pyx_pybuffer_a_eN.pybuffer.buf = NULL;
8971  __pyx_pybuffer_a_eN.refcount = 0;
8972  __pyx_pybuffernd_a_eN.data = NULL;
8973  __pyx_pybuffernd_a_eN.rcbuffer = &__pyx_pybuffer_a_eN;
8974  __pyx_pybuffer_a_neig.pybuffer.buf = NULL;
8975  __pyx_pybuffer_a_neig.refcount = 0;
8976  __pyx_pybuffernd_a_neig.data = NULL;
8977  __pyx_pybuffernd_a_neig.rcbuffer = &__pyx_pybuffer_a_neig;
8978  __pyx_pybuffer_a_avg.pybuffer.buf = NULL;
8979  __pyx_pybuffer_a_avg.refcount = 0;
8980  __pyx_pybuffernd_a_avg.data = NULL;
8981  __pyx_pybuffernd_a_avg.rcbuffer = &__pyx_pybuffer_a_avg;
8982  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
8983  __pyx_pybuffer_gravity.refcount = 0;
8984  __pyx_pybuffernd_gravity.data = NULL;
8985  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
8986  __pyx_pybuffer_rowptr.pybuffer.buf = NULL;
8987  __pyx_pybuffer_rowptr.refcount = 0;
8988  __pyx_pybuffernd_rowptr.data = NULL;
8989  __pyx_pybuffernd_rowptr.rcbuffer = &__pyx_pybuffer_rowptr;
8990  __pyx_pybuffer_colind.pybuffer.buf = NULL;
8991  __pyx_pybuffer_colind.refcount = 0;
8992  __pyx_pybuffernd_colind.data = NULL;
8993  __pyx_pybuffernd_colind.rcbuffer = &__pyx_pybuffer_colind;
8994  __pyx_pybuffer_KWs.pybuffer.buf = NULL;
8995  __pyx_pybuffer_KWs.refcount = 0;
8996  __pyx_pybuffernd_KWs.data = NULL;
8997  __pyx_pybuffernd_KWs.rcbuffer = &__pyx_pybuffer_KWs;
8998  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
8999  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
9000  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
9001  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
9002  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
9003  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
9004  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
9005  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
9006  __pyx_pybuffer_q_flin.pybuffer.buf = NULL;
9007  __pyx_pybuffer_q_flin.refcount = 0;
9008  __pyx_pybuffernd_q_flin.data = NULL;
9009  __pyx_pybuffernd_q_flin.rcbuffer = &__pyx_pybuffer_q_flin;
9010  __pyx_pybuffer_q_alin.pybuffer.buf = NULL;
9011  __pyx_pybuffer_q_alin.refcount = 0;
9012  __pyx_pybuffernd_q_alin.data = NULL;
9013  __pyx_pybuffernd_q_alin.rcbuffer = &__pyx_pybuffer_q_alin;
9014  {
9015  __Pyx_BufFmt_StackElem __pyx_stack[1];
9016  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9017  }
9018  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
9019  {
9020  __Pyx_BufFmt_StackElem __pyx_stack[1];
9021  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_rowptr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9022  }
9023  __pyx_pybuffernd_rowptr.diminfo[0].strides = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rowptr.diminfo[0].shape = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.shape[0];
9024  {
9025  __Pyx_BufFmt_StackElem __pyx_stack[1];
9026  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_colind.rcbuffer->pybuffer, (PyObject*)__pyx_v_colind, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9027  }
9028  __pyx_pybuffernd_colind.diminfo[0].strides = __pyx_pybuffernd_colind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_colind.diminfo[0].shape = __pyx_pybuffernd_colind.rcbuffer->pybuffer.shape[0];
9029  {
9030  __Pyx_BufFmt_StackElem __pyx_stack[1];
9031  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_KWs.rcbuffer->pybuffer, (PyObject*)__pyx_v_KWs, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9032  }
9033  __pyx_pybuffernd_KWs.diminfo[0].strides = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_KWs.diminfo[0].shape = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_KWs.diminfo[1].strides = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_KWs.diminfo[1].shape = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.shape[1];
9034  {
9035  __Pyx_BufFmt_StackElem __pyx_stack[1];
9036  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9037  }
9038  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
9039  {
9040  __Pyx_BufFmt_StackElem __pyx_stack[1];
9041  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9042  }
9043  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
9044  {
9045  __Pyx_BufFmt_StackElem __pyx_stack[1];
9046  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_flin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9047  }
9048  __pyx_pybuffernd_q_flin.diminfo[0].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_flin.diminfo[0].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_flin.diminfo[1].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_flin.diminfo[1].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_flin.diminfo[2].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_flin.diminfo[2].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[2];
9049  {
9050  __Pyx_BufFmt_StackElem __pyx_stack[1];
9051  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_alin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9052  }
9053  __pyx_pybuffernd_q_alin.diminfo[0].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_alin.diminfo[0].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_alin.diminfo[1].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_alin.diminfo[1].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_alin.diminfo[2].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_alin.diminfo[2].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[2];
9054 
9055  /* "subsurfaceTransportFunctions.pyx":328
9056  * #temporaries
9057  * cdef int eN,eN_neighbor,ii,I,ebN,matID,matID_neig
9058  * cdef int nSpace2 = nSpace*nSpace # <<<<<<<<<<<<<<
9059  * cdef int nnz = rowptr[nSpace]
9060  *
9061  */
9062  __pyx_v_nSpace2 = (__pyx_v_nSpace * __pyx_v_nSpace);
9063 
9064  /* "subsurfaceTransportFunctions.pyx":329
9065  * cdef int eN,eN_neighbor,ii,I,ebN,matID,matID_neig
9066  * cdef int nSpace2 = nSpace*nSpace
9067  * cdef int nnz = rowptr[nSpace] # <<<<<<<<<<<<<<
9068  *
9069  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d')
9070  */
9071  __pyx_t_1 = __pyx_v_nSpace;
9072  __pyx_t_2 = -1;
9073  if (__pyx_t_1 < 0) {
9074  __pyx_t_1 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
9075  if (unlikely(__pyx_t_1 < 0)) __pyx_t_2 = 0;
9076  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_2 = 0;
9077  if (unlikely(__pyx_t_2 != -1)) {
9078  __Pyx_RaiseBufferIndexError(__pyx_t_2);
9079  __PYX_ERR(0, 329, __pyx_L1_error)
9080  }
9081  __pyx_v_nnz = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_rowptr.diminfo[0].strides));
9082 
9083  /* "subsurfaceTransportFunctions.pyx":331
9084  * cdef int nnz = rowptr[nSpace]
9085  *
9086  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
9087  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_neig = numpy.zeros(nnz,'d')
9088  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_avg = numpy.zeros(nnz,'d')
9089  */
9090  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 331, __pyx_L1_error)
9091  __Pyx_GOTREF(__pyx_t_4);
9092  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 331, __pyx_L1_error)
9093  __Pyx_GOTREF(__pyx_t_5);
9094  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9095  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 331, __pyx_L1_error)
9096  __Pyx_GOTREF(__pyx_t_4);
9097  __pyx_t_6 = NULL;
9098  __pyx_t_2 = 0;
9099  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
9100  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
9101  if (likely(__pyx_t_6)) {
9102  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
9103  __Pyx_INCREF(__pyx_t_6);
9104  __Pyx_INCREF(function);
9105  __Pyx_DECREF_SET(__pyx_t_5, function);
9106  __pyx_t_2 = 1;
9107  }
9108  }
9109  #if CYTHON_FAST_PYCALL
9110  if (PyFunction_Check(__pyx_t_5)) {
9111  PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_n_s_d};
9112  __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
9113  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9114  __Pyx_GOTREF(__pyx_t_3);
9115  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9116  } else
9117  #endif
9118  #if CYTHON_FAST_PYCCALL
9119  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
9120  PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_n_s_d};
9121  __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
9122  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9123  __Pyx_GOTREF(__pyx_t_3);
9124  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9125  } else
9126  #endif
9127  {
9128  __pyx_t_7 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 331, __pyx_L1_error)
9129  __Pyx_GOTREF(__pyx_t_7);
9130  if (__pyx_t_6) {
9131  __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
9132  }
9133  __Pyx_GIVEREF(__pyx_t_4);
9134  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_2, __pyx_t_4);
9135  __Pyx_INCREF(__pyx_n_s_d);
9136  __Pyx_GIVEREF(__pyx_n_s_d);
9137  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_2, __pyx_n_s_d);
9138  __pyx_t_4 = 0;
9139  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
9140  __Pyx_GOTREF(__pyx_t_3);
9141  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9142  }
9143  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9144  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 331, __pyx_L1_error)
9145  __pyx_t_8 = ((PyArrayObject *)__pyx_t_3);
9146  {
9147  __Pyx_BufFmt_StackElem __pyx_stack[1];
9148  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_eN.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
9149  __pyx_v_a_eN = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf = NULL;
9150  __PYX_ERR(0, 331, __pyx_L1_error)
9151  } else {__pyx_pybuffernd_a_eN.diminfo[0].strides = __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_eN.diminfo[0].shape = __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.shape[0];
9152  }
9153  }
9154  __pyx_t_8 = 0;
9155  __pyx_v_a_eN = ((PyArrayObject *)__pyx_t_3);
9156  __pyx_t_3 = 0;
9157 
9158  /* "subsurfaceTransportFunctions.pyx":332
9159  *
9160  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d')
9161  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_neig = numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
9162  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_avg = numpy.zeros(nnz,'d')
9163  *
9164  */
9165  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 332, __pyx_L1_error)
9166  __Pyx_GOTREF(__pyx_t_5);
9167  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 332, __pyx_L1_error)
9168  __Pyx_GOTREF(__pyx_t_7);
9169  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9170  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 332, __pyx_L1_error)
9171  __Pyx_GOTREF(__pyx_t_5);
9172  __pyx_t_4 = NULL;
9173  __pyx_t_2 = 0;
9174  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
9175  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
9176  if (likely(__pyx_t_4)) {
9177  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
9178  __Pyx_INCREF(__pyx_t_4);
9179  __Pyx_INCREF(function);
9180  __Pyx_DECREF_SET(__pyx_t_7, function);
9181  __pyx_t_2 = 1;
9182  }
9183  }
9184  #if CYTHON_FAST_PYCALL
9185  if (PyFunction_Check(__pyx_t_7)) {
9186  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
9187  __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error)
9188  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9189  __Pyx_GOTREF(__pyx_t_3);
9190  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9191  } else
9192  #endif
9193  #if CYTHON_FAST_PYCCALL
9194  if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
9195  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
9196  __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error)
9197  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9198  __Pyx_GOTREF(__pyx_t_3);
9199  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9200  } else
9201  #endif
9202  {
9203  __pyx_t_6 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 332, __pyx_L1_error)
9204  __Pyx_GOTREF(__pyx_t_6);
9205  if (__pyx_t_4) {
9206  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
9207  }
9208  __Pyx_GIVEREF(__pyx_t_5);
9209  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_2, __pyx_t_5);
9210  __Pyx_INCREF(__pyx_n_s_d);
9211  __Pyx_GIVEREF(__pyx_n_s_d);
9212  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_2, __pyx_n_s_d);
9213  __pyx_t_5 = 0;
9214  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error)
9215  __Pyx_GOTREF(__pyx_t_3);
9216  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9217  }
9218  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9219  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 332, __pyx_L1_error)
9220  __pyx_t_9 = ((PyArrayObject *)__pyx_t_3);
9221  {
9222  __Pyx_BufFmt_StackElem __pyx_stack[1];
9223  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_neig.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
9224  __pyx_v_a_neig = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf = NULL;
9225  __PYX_ERR(0, 332, __pyx_L1_error)
9226  } else {__pyx_pybuffernd_a_neig.diminfo[0].strides = __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_neig.diminfo[0].shape = __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.shape[0];
9227  }
9228  }
9229  __pyx_t_9 = 0;
9230  __pyx_v_a_neig = ((PyArrayObject *)__pyx_t_3);
9231  __pyx_t_3 = 0;
9232 
9233  /* "subsurfaceTransportFunctions.pyx":333
9234  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d')
9235  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_neig = numpy.zeros(nnz,'d')
9236  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_avg = numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
9237  *
9238  * #loop through and evaluate
9239  */
9240  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_numpy); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 333, __pyx_L1_error)
9241  __Pyx_GOTREF(__pyx_t_7);
9242  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 333, __pyx_L1_error)
9243  __Pyx_GOTREF(__pyx_t_6);
9244  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9245  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 333, __pyx_L1_error)
9246  __Pyx_GOTREF(__pyx_t_7);
9247  __pyx_t_5 = NULL;
9248  __pyx_t_2 = 0;
9249  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
9250  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
9251  if (likely(__pyx_t_5)) {
9252  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
9253  __Pyx_INCREF(__pyx_t_5);
9254  __Pyx_INCREF(function);
9255  __Pyx_DECREF_SET(__pyx_t_6, function);
9256  __pyx_t_2 = 1;
9257  }
9258  }
9259  #if CYTHON_FAST_PYCALL
9260  if (PyFunction_Check(__pyx_t_6)) {
9261  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_7, __pyx_n_s_d};
9262  __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
9263  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9264  __Pyx_GOTREF(__pyx_t_3);
9265  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9266  } else
9267  #endif
9268  #if CYTHON_FAST_PYCCALL
9269  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
9270  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_7, __pyx_n_s_d};
9271  __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
9272  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9273  __Pyx_GOTREF(__pyx_t_3);
9274  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9275  } else
9276  #endif
9277  {
9278  __pyx_t_4 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error)
9279  __Pyx_GOTREF(__pyx_t_4);
9280  if (__pyx_t_5) {
9281  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
9282  }
9283  __Pyx_GIVEREF(__pyx_t_7);
9284  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_2, __pyx_t_7);
9285  __Pyx_INCREF(__pyx_n_s_d);
9286  __Pyx_GIVEREF(__pyx_n_s_d);
9287  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_2, __pyx_n_s_d);
9288  __pyx_t_7 = 0;
9289  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
9290  __Pyx_GOTREF(__pyx_t_3);
9291  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9292  }
9293  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9294  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 333, __pyx_L1_error)
9295  __pyx_t_10 = ((PyArrayObject *)__pyx_t_3);
9296  {
9297  __Pyx_BufFmt_StackElem __pyx_stack[1];
9298  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_avg.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
9299  __pyx_v_a_avg = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf = NULL;
9300  __PYX_ERR(0, 333, __pyx_L1_error)
9301  } else {__pyx_pybuffernd_a_avg.diminfo[0].strides = __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_avg.diminfo[0].shape = __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.shape[0];
9302  }
9303  }
9304  __pyx_t_10 = 0;
9305  __pyx_v_a_avg = ((PyArrayObject *)__pyx_t_3);
9306  __pyx_t_3 = 0;
9307 
9308  /* "subsurfaceTransportFunctions.pyx":336
9309  *
9310  * #loop through and evaluate
9311  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
9312  * matID = elementMaterialTypes[eN]
9313  * for ii in range(nnz):
9314  */
9315  __pyx_t_2 = __pyx_v_nElements_global;
9316  __pyx_t_11 = __pyx_t_2;
9317  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
9318  __pyx_v_eN = __pyx_t_12;
9319 
9320  /* "subsurfaceTransportFunctions.pyx":337
9321  * #loop through and evaluate
9322  * for eN in range(nElements_global):
9323  * matID = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
9324  * for ii in range(nnz):
9325  * a_eN[ii] = rho*KWs[matID,ii]
9326  */
9327  __pyx_t_13 = __pyx_v_eN;
9328  __pyx_t_14 = -1;
9329  if (__pyx_t_13 < 0) {
9330  __pyx_t_13 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
9331  if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 0;
9332  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_14 = 0;
9333  if (unlikely(__pyx_t_14 != -1)) {
9334  __Pyx_RaiseBufferIndexError(__pyx_t_14);
9335  __PYX_ERR(0, 337, __pyx_L1_error)
9336  }
9337  __pyx_v_matID = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
9338 
9339  /* "subsurfaceTransportFunctions.pyx":338
9340  * for eN in range(nElements_global):
9341  * matID = elementMaterialTypes[eN]
9342  * for ii in range(nnz): # <<<<<<<<<<<<<<
9343  * a_eN[ii] = rho*KWs[matID,ii]
9344  * for ebN in range(nElementBoundaries_element):
9345  */
9346  __pyx_t_14 = __pyx_v_nnz;
9347  __pyx_t_15 = __pyx_t_14;
9348  for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
9349  __pyx_v_ii = __pyx_t_16;
9350 
9351  /* "subsurfaceTransportFunctions.pyx":339
9352  * matID = elementMaterialTypes[eN]
9353  * for ii in range(nnz):
9354  * a_eN[ii] = rho*KWs[matID,ii] # <<<<<<<<<<<<<<
9355  * for ebN in range(nElementBoundaries_element):
9356  * eN_neighbor = elementNeighborsArray[eN,ebN]
9357  */
9358  __pyx_t_17 = __pyx_v_matID;
9359  __pyx_t_18 = __pyx_v_ii;
9360  __pyx_t_19 = -1;
9361  if (__pyx_t_17 < 0) {
9362  __pyx_t_17 += __pyx_pybuffernd_KWs.diminfo[0].shape;
9363  if (unlikely(__pyx_t_17 < 0)) __pyx_t_19 = 0;
9364  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_KWs.diminfo[0].shape)) __pyx_t_19 = 0;
9365  if (__pyx_t_18 < 0) {
9366  __pyx_t_18 += __pyx_pybuffernd_KWs.diminfo[1].shape;
9367  if (unlikely(__pyx_t_18 < 0)) __pyx_t_19 = 1;
9368  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_KWs.diminfo[1].shape)) __pyx_t_19 = 1;
9369  if (unlikely(__pyx_t_19 != -1)) {
9370  __Pyx_RaiseBufferIndexError(__pyx_t_19);
9371  __PYX_ERR(0, 339, __pyx_L1_error)
9372  }
9373  __pyx_t_20 = __pyx_v_ii;
9374  __pyx_t_19 = -1;
9375  if (__pyx_t_20 < 0) {
9376  __pyx_t_20 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
9377  if (unlikely(__pyx_t_20 < 0)) __pyx_t_19 = 0;
9378  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_19 = 0;
9379  if (unlikely(__pyx_t_19 != -1)) {
9380  __Pyx_RaiseBufferIndexError(__pyx_t_19);
9381  __PYX_ERR(0, 339, __pyx_L1_error)
9382  }
9383  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_a_eN.diminfo[0].strides) = (__pyx_v_rho * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_KWs.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_KWs.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_KWs.diminfo[1].strides)));
9384  }
9385 
9386  /* "subsurfaceTransportFunctions.pyx":340
9387  * for ii in range(nnz):
9388  * a_eN[ii] = rho*KWs[matID,ii]
9389  * for ebN in range(nElementBoundaries_element): # <<<<<<<<<<<<<<
9390  * eN_neighbor = elementNeighborsArray[eN,ebN]
9391  * for ii in range(nnz):
9392  */
9393  __pyx_t_14 = __pyx_v_nElementBoundaries_element;
9394  __pyx_t_15 = __pyx_t_14;
9395  for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
9396  __pyx_v_ebN = __pyx_t_16;
9397 
9398  /* "subsurfaceTransportFunctions.pyx":341
9399  * a_eN[ii] = rho*KWs[matID,ii]
9400  * for ebN in range(nElementBoundaries_element):
9401  * eN_neighbor = elementNeighborsArray[eN,ebN] # <<<<<<<<<<<<<<
9402  * for ii in range(nnz):
9403  * a_neig[ii] = a_eN[ii]
9404  */
9405  __pyx_t_21 = __pyx_v_eN;
9406  __pyx_t_22 = __pyx_v_ebN;
9407  __pyx_t_19 = -1;
9408  if (__pyx_t_21 < 0) {
9409  __pyx_t_21 += __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape;
9410  if (unlikely(__pyx_t_21 < 0)) __pyx_t_19 = 0;
9411  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape)) __pyx_t_19 = 0;
9412  if (__pyx_t_22 < 0) {
9413  __pyx_t_22 += __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape;
9414  if (unlikely(__pyx_t_22 < 0)) __pyx_t_19 = 1;
9415  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape)) __pyx_t_19 = 1;
9416  if (unlikely(__pyx_t_19 != -1)) {
9417  __Pyx_RaiseBufferIndexError(__pyx_t_19);
9418  __PYX_ERR(0, 341, __pyx_L1_error)
9419  }
9420  __pyx_v_eN_neighbor = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides));
9421 
9422  /* "subsurfaceTransportFunctions.pyx":342
9423  * for ebN in range(nElementBoundaries_element):
9424  * eN_neighbor = elementNeighborsArray[eN,ebN]
9425  * for ii in range(nnz): # <<<<<<<<<<<<<<
9426  * a_neig[ii] = a_eN[ii]
9427  * if eN_neighbor >= 0:
9428  */
9429  __pyx_t_19 = __pyx_v_nnz;
9430  __pyx_t_23 = __pyx_t_19;
9431  for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) {
9432  __pyx_v_ii = __pyx_t_24;
9433 
9434  /* "subsurfaceTransportFunctions.pyx":343
9435  * eN_neighbor = elementNeighborsArray[eN,ebN]
9436  * for ii in range(nnz):
9437  * a_neig[ii] = a_eN[ii] # <<<<<<<<<<<<<<
9438  * if eN_neighbor >= 0:
9439  * matID_neig = elementMaterialTypes[eN_neighbor]
9440  */
9441  __pyx_t_25 = __pyx_v_ii;
9442  __pyx_t_26 = -1;
9443  if (__pyx_t_25 < 0) {
9444  __pyx_t_25 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
9445  if (unlikely(__pyx_t_25 < 0)) __pyx_t_26 = 0;
9446  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_26 = 0;
9447  if (unlikely(__pyx_t_26 != -1)) {
9448  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9449  __PYX_ERR(0, 343, __pyx_L1_error)
9450  }
9451  __pyx_t_27 = __pyx_v_ii;
9452  __pyx_t_26 = -1;
9453  if (__pyx_t_27 < 0) {
9454  __pyx_t_27 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
9455  if (unlikely(__pyx_t_27 < 0)) __pyx_t_26 = 0;
9456  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_26 = 0;
9457  if (unlikely(__pyx_t_26 != -1)) {
9458  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9459  __PYX_ERR(0, 343, __pyx_L1_error)
9460  }
9461  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_a_neig.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_a_eN.diminfo[0].strides));
9462  }
9463 
9464  /* "subsurfaceTransportFunctions.pyx":344
9465  * for ii in range(nnz):
9466  * a_neig[ii] = a_eN[ii]
9467  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
9468  * matID_neig = elementMaterialTypes[eN_neighbor]
9469  * for ii in range(nnz):
9470  */
9471  __pyx_t_28 = ((__pyx_v_eN_neighbor >= 0) != 0);
9472  if (__pyx_t_28) {
9473 
9474  /* "subsurfaceTransportFunctions.pyx":345
9475  * a_neig[ii] = a_eN[ii]
9476  * if eN_neighbor >= 0:
9477  * matID_neig = elementMaterialTypes[eN_neighbor] # <<<<<<<<<<<<<<
9478  * for ii in range(nnz):
9479  * a_neig[ii] = rho*KWs[matID_neig,ii]
9480  */
9481  __pyx_t_29 = __pyx_v_eN_neighbor;
9482  __pyx_t_19 = -1;
9483  if (__pyx_t_29 < 0) {
9484  __pyx_t_29 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
9485  if (unlikely(__pyx_t_29 < 0)) __pyx_t_19 = 0;
9486  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_19 = 0;
9487  if (unlikely(__pyx_t_19 != -1)) {
9488  __Pyx_RaiseBufferIndexError(__pyx_t_19);
9489  __PYX_ERR(0, 345, __pyx_L1_error)
9490  }
9491  __pyx_v_matID_neig = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
9492 
9493  /* "subsurfaceTransportFunctions.pyx":346
9494  * if eN_neighbor >= 0:
9495  * matID_neig = elementMaterialTypes[eN_neighbor]
9496  * for ii in range(nnz): # <<<<<<<<<<<<<<
9497  * a_neig[ii] = rho*KWs[matID_neig,ii]
9498  * for ii in range(nnz):
9499  */
9500  __pyx_t_19 = __pyx_v_nnz;
9501  __pyx_t_23 = __pyx_t_19;
9502  for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) {
9503  __pyx_v_ii = __pyx_t_24;
9504 
9505  /* "subsurfaceTransportFunctions.pyx":347
9506  * matID_neig = elementMaterialTypes[eN_neighbor]
9507  * for ii in range(nnz):
9508  * a_neig[ii] = rho*KWs[matID_neig,ii] # <<<<<<<<<<<<<<
9509  * for ii in range(nnz):
9510  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
9511  */
9512  __pyx_t_30 = __pyx_v_matID_neig;
9513  __pyx_t_31 = __pyx_v_ii;
9514  __pyx_t_26 = -1;
9515  if (__pyx_t_30 < 0) {
9516  __pyx_t_30 += __pyx_pybuffernd_KWs.diminfo[0].shape;
9517  if (unlikely(__pyx_t_30 < 0)) __pyx_t_26 = 0;
9518  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_KWs.diminfo[0].shape)) __pyx_t_26 = 0;
9519  if (__pyx_t_31 < 0) {
9520  __pyx_t_31 += __pyx_pybuffernd_KWs.diminfo[1].shape;
9521  if (unlikely(__pyx_t_31 < 0)) __pyx_t_26 = 1;
9522  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_KWs.diminfo[1].shape)) __pyx_t_26 = 1;
9523  if (unlikely(__pyx_t_26 != -1)) {
9524  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9525  __PYX_ERR(0, 347, __pyx_L1_error)
9526  }
9527  __pyx_t_32 = __pyx_v_ii;
9528  __pyx_t_26 = -1;
9529  if (__pyx_t_32 < 0) {
9530  __pyx_t_32 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
9531  if (unlikely(__pyx_t_32 < 0)) __pyx_t_26 = 0;
9532  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_26 = 0;
9533  if (unlikely(__pyx_t_26 != -1)) {
9534  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9535  __PYX_ERR(0, 347, __pyx_L1_error)
9536  }
9537  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_a_neig.diminfo[0].strides) = (__pyx_v_rho * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_KWs.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_KWs.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_KWs.diminfo[1].strides)));
9538  }
9539 
9540  /* "subsurfaceTransportFunctions.pyx":344
9541  * for ii in range(nnz):
9542  * a_neig[ii] = a_eN[ii]
9543  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
9544  * matID_neig = elementMaterialTypes[eN_neighbor]
9545  * for ii in range(nnz):
9546  */
9547  }
9548 
9549  /* "subsurfaceTransportFunctions.pyx":348
9550  * for ii in range(nnz):
9551  * a_neig[ii] = rho*KWs[matID_neig,ii]
9552  * for ii in range(nnz): # <<<<<<<<<<<<<<
9553  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
9554  * q_alin[eN,ebN,ii] = a_avg[ii]
9555  */
9556  __pyx_t_19 = __pyx_v_nnz;
9557  __pyx_t_23 = __pyx_t_19;
9558  for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) {
9559  __pyx_v_ii = __pyx_t_24;
9560 
9561  /* "subsurfaceTransportFunctions.pyx":349
9562  * a_neig[ii] = rho*KWs[matID_neig,ii]
9563  * for ii in range(nnz):
9564  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20) # <<<<<<<<<<<<<<
9565  * q_alin[eN,ebN,ii] = a_avg[ii]
9566  * for I in range(nSpace):
9567  */
9568  __pyx_t_33 = __pyx_v_ii;
9569  __pyx_t_26 = -1;
9570  if (__pyx_t_33 < 0) {
9571  __pyx_t_33 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
9572  if (unlikely(__pyx_t_33 < 0)) __pyx_t_26 = 0;
9573  } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_26 = 0;
9574  if (unlikely(__pyx_t_26 != -1)) {
9575  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9576  __PYX_ERR(0, 349, __pyx_L1_error)
9577  }
9578  __pyx_t_34 = __pyx_v_ii;
9579  __pyx_t_26 = -1;
9580  if (__pyx_t_34 < 0) {
9581  __pyx_t_34 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
9582  if (unlikely(__pyx_t_34 < 0)) __pyx_t_26 = 0;
9583  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_26 = 0;
9584  if (unlikely(__pyx_t_26 != -1)) {
9585  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9586  __PYX_ERR(0, 349, __pyx_L1_error)
9587  }
9588  __pyx_t_35 = ((2.0 * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_a_eN.diminfo[0].strides))) * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_a_neig.diminfo[0].strides)));
9589  __pyx_t_36 = __pyx_v_ii;
9590  __pyx_t_26 = -1;
9591  if (__pyx_t_36 < 0) {
9592  __pyx_t_36 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
9593  if (unlikely(__pyx_t_36 < 0)) __pyx_t_26 = 0;
9594  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_26 = 0;
9595  if (unlikely(__pyx_t_26 != -1)) {
9596  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9597  __PYX_ERR(0, 349, __pyx_L1_error)
9598  }
9599  __pyx_t_37 = __pyx_v_ii;
9600  __pyx_t_26 = -1;
9601  if (__pyx_t_37 < 0) {
9602  __pyx_t_37 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
9603  if (unlikely(__pyx_t_37 < 0)) __pyx_t_26 = 0;
9604  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_26 = 0;
9605  if (unlikely(__pyx_t_26 != -1)) {
9606  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9607  __PYX_ERR(0, 349, __pyx_L1_error)
9608  }
9609  __pyx_t_38 = (((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_a_eN.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_a_neig.diminfo[0].strides))) + 1.0e-20);
9610  if (unlikely(__pyx_t_38 == 0)) {
9611  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
9612  __PYX_ERR(0, 349, __pyx_L1_error)
9613  }
9614  __pyx_t_39 = __pyx_v_ii;
9615  __pyx_t_26 = -1;
9616  if (__pyx_t_39 < 0) {
9617  __pyx_t_39 += __pyx_pybuffernd_a_avg.diminfo[0].shape;
9618  if (unlikely(__pyx_t_39 < 0)) __pyx_t_26 = 0;
9619  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_a_avg.diminfo[0].shape)) __pyx_t_26 = 0;
9620  if (unlikely(__pyx_t_26 != -1)) {
9621  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9622  __PYX_ERR(0, 349, __pyx_L1_error)
9623  }
9624  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_a_avg.diminfo[0].strides) = (__pyx_t_35 / __pyx_t_38);
9625 
9626  /* "subsurfaceTransportFunctions.pyx":350
9627  * for ii in range(nnz):
9628  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
9629  * q_alin[eN,ebN,ii] = a_avg[ii] # <<<<<<<<<<<<<<
9630  * for I in range(nSpace):
9631  * q_flin[eN,ebN,I] = 0.0
9632  */
9633  __pyx_t_40 = __pyx_v_ii;
9634  __pyx_t_26 = -1;
9635  if (__pyx_t_40 < 0) {
9636  __pyx_t_40 += __pyx_pybuffernd_a_avg.diminfo[0].shape;
9637  if (unlikely(__pyx_t_40 < 0)) __pyx_t_26 = 0;
9638  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_a_avg.diminfo[0].shape)) __pyx_t_26 = 0;
9639  if (unlikely(__pyx_t_26 != -1)) {
9640  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9641  __PYX_ERR(0, 350, __pyx_L1_error)
9642  }
9643  __pyx_t_41 = __pyx_v_eN;
9644  __pyx_t_42 = __pyx_v_ebN;
9645  __pyx_t_43 = __pyx_v_ii;
9646  __pyx_t_26 = -1;
9647  if (__pyx_t_41 < 0) {
9648  __pyx_t_41 += __pyx_pybuffernd_q_alin.diminfo[0].shape;
9649  if (unlikely(__pyx_t_41 < 0)) __pyx_t_26 = 0;
9650  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_q_alin.diminfo[0].shape)) __pyx_t_26 = 0;
9651  if (__pyx_t_42 < 0) {
9652  __pyx_t_42 += __pyx_pybuffernd_q_alin.diminfo[1].shape;
9653  if (unlikely(__pyx_t_42 < 0)) __pyx_t_26 = 1;
9654  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_q_alin.diminfo[1].shape)) __pyx_t_26 = 1;
9655  if (__pyx_t_43 < 0) {
9656  __pyx_t_43 += __pyx_pybuffernd_q_alin.diminfo[2].shape;
9657  if (unlikely(__pyx_t_43 < 0)) __pyx_t_26 = 2;
9658  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_q_alin.diminfo[2].shape)) __pyx_t_26 = 2;
9659  if (unlikely(__pyx_t_26 != -1)) {
9660  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9661  __PYX_ERR(0, 350, __pyx_L1_error)
9662  }
9663  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_q_alin.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_q_alin.diminfo[1].strides, __pyx_t_43, __pyx_pybuffernd_q_alin.diminfo[2].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_a_avg.diminfo[0].strides));
9664  }
9665 
9666  /* "subsurfaceTransportFunctions.pyx":351
9667  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
9668  * q_alin[eN,ebN,ii] = a_avg[ii]
9669  * for I in range(nSpace): # <<<<<<<<<<<<<<
9670  * q_flin[eN,ebN,I] = 0.0
9671  * for ii in range(rowptr[I],rowptr[I+1]):
9672  */
9673  __pyx_t_19 = __pyx_v_nSpace;
9674  __pyx_t_23 = __pyx_t_19;
9675  for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) {
9676  __pyx_v_I = __pyx_t_24;
9677 
9678  /* "subsurfaceTransportFunctions.pyx":352
9679  * q_alin[eN,ebN,ii] = a_avg[ii]
9680  * for I in range(nSpace):
9681  * q_flin[eN,ebN,I] = 0.0 # <<<<<<<<<<<<<<
9682  * for ii in range(rowptr[I],rowptr[I+1]):
9683  * q_flin[eN,ebN,I] += rho*a_avg[ii]*gravity[colind[ii]]
9684  */
9685  __pyx_t_44 = __pyx_v_eN;
9686  __pyx_t_45 = __pyx_v_ebN;
9687  __pyx_t_46 = __pyx_v_I;
9688  __pyx_t_26 = -1;
9689  if (__pyx_t_44 < 0) {
9690  __pyx_t_44 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
9691  if (unlikely(__pyx_t_44 < 0)) __pyx_t_26 = 0;
9692  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_26 = 0;
9693  if (__pyx_t_45 < 0) {
9694  __pyx_t_45 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
9695  if (unlikely(__pyx_t_45 < 0)) __pyx_t_26 = 1;
9696  } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_26 = 1;
9697  if (__pyx_t_46 < 0) {
9698  __pyx_t_46 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
9699  if (unlikely(__pyx_t_46 < 0)) __pyx_t_26 = 2;
9700  } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_26 = 2;
9701  if (unlikely(__pyx_t_26 != -1)) {
9702  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9703  __PYX_ERR(0, 352, __pyx_L1_error)
9704  }
9705  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_46, __pyx_pybuffernd_q_flin.diminfo[2].strides) = 0.0;
9706 
9707  /* "subsurfaceTransportFunctions.pyx":353
9708  * for I in range(nSpace):
9709  * q_flin[eN,ebN,I] = 0.0
9710  * for ii in range(rowptr[I],rowptr[I+1]): # <<<<<<<<<<<<<<
9711  * q_flin[eN,ebN,I] += rho*a_avg[ii]*gravity[colind[ii]]
9712  * #ebN
9713  */
9714  __pyx_t_47 = (__pyx_v_I + 1);
9715  __pyx_t_26 = -1;
9716  if (__pyx_t_47 < 0) {
9717  __pyx_t_47 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
9718  if (unlikely(__pyx_t_47 < 0)) __pyx_t_26 = 0;
9719  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_26 = 0;
9720  if (unlikely(__pyx_t_26 != -1)) {
9721  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9722  __PYX_ERR(0, 353, __pyx_L1_error)
9723  }
9724  __pyx_t_48 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_rowptr.diminfo[0].strides));
9725  __pyx_t_49 = __pyx_v_I;
9726  __pyx_t_26 = -1;
9727  if (__pyx_t_49 < 0) {
9728  __pyx_t_49 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
9729  if (unlikely(__pyx_t_49 < 0)) __pyx_t_26 = 0;
9730  } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_26 = 0;
9731  if (unlikely(__pyx_t_26 != -1)) {
9732  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9733  __PYX_ERR(0, 353, __pyx_L1_error)
9734  }
9735  __pyx_t_50 = __pyx_t_48;
9736  for (__pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_rowptr.diminfo[0].strides)); __pyx_t_26 < __pyx_t_50; __pyx_t_26+=1) {
9737  __pyx_v_ii = __pyx_t_26;
9738 
9739  /* "subsurfaceTransportFunctions.pyx":354
9740  * q_flin[eN,ebN,I] = 0.0
9741  * for ii in range(rowptr[I],rowptr[I+1]):
9742  * q_flin[eN,ebN,I] += rho*a_avg[ii]*gravity[colind[ii]] # <<<<<<<<<<<<<<
9743  * #ebN
9744  * #eN
9745  */
9746  __pyx_t_51 = __pyx_v_ii;
9747  __pyx_t_52 = -1;
9748  if (__pyx_t_51 < 0) {
9749  __pyx_t_51 += __pyx_pybuffernd_a_avg.diminfo[0].shape;
9750  if (unlikely(__pyx_t_51 < 0)) __pyx_t_52 = 0;
9751  } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_a_avg.diminfo[0].shape)) __pyx_t_52 = 0;
9752  if (unlikely(__pyx_t_52 != -1)) {
9753  __Pyx_RaiseBufferIndexError(__pyx_t_52);
9754  __PYX_ERR(0, 354, __pyx_L1_error)
9755  }
9756  __pyx_t_53 = __pyx_v_ii;
9757  __pyx_t_52 = -1;
9758  if (__pyx_t_53 < 0) {
9759  __pyx_t_53 += __pyx_pybuffernd_colind.diminfo[0].shape;
9760  if (unlikely(__pyx_t_53 < 0)) __pyx_t_52 = 0;
9761  } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_colind.diminfo[0].shape)) __pyx_t_52 = 0;
9762  if (unlikely(__pyx_t_52 != -1)) {
9763  __Pyx_RaiseBufferIndexError(__pyx_t_52);
9764  __PYX_ERR(0, 354, __pyx_L1_error)
9765  }
9766  __pyx_t_54 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_colind.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_colind.diminfo[0].strides));
9767  __pyx_t_52 = -1;
9768  if (__pyx_t_54 < 0) {
9769  __pyx_t_54 += __pyx_pybuffernd_gravity.diminfo[0].shape;
9770  if (unlikely(__pyx_t_54 < 0)) __pyx_t_52 = 0;
9771  } else if (unlikely(__pyx_t_54 >= __pyx_pybuffernd_gravity.diminfo[0].shape)) __pyx_t_52 = 0;
9772  if (unlikely(__pyx_t_52 != -1)) {
9773  __Pyx_RaiseBufferIndexError(__pyx_t_52);
9774  __PYX_ERR(0, 354, __pyx_L1_error)
9775  }
9776  __pyx_t_55 = __pyx_v_eN;
9777  __pyx_t_56 = __pyx_v_ebN;
9778  __pyx_t_57 = __pyx_v_I;
9779  __pyx_t_52 = -1;
9780  if (__pyx_t_55 < 0) {
9781  __pyx_t_55 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
9782  if (unlikely(__pyx_t_55 < 0)) __pyx_t_52 = 0;
9783  } else if (unlikely(__pyx_t_55 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_52 = 0;
9784  if (__pyx_t_56 < 0) {
9785  __pyx_t_56 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
9786  if (unlikely(__pyx_t_56 < 0)) __pyx_t_52 = 1;
9787  } else if (unlikely(__pyx_t_56 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_52 = 1;
9788  if (__pyx_t_57 < 0) {
9789  __pyx_t_57 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
9790  if (unlikely(__pyx_t_57 < 0)) __pyx_t_52 = 2;
9791  } else if (unlikely(__pyx_t_57 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_52 = 2;
9792  if (unlikely(__pyx_t_52 != -1)) {
9793  __Pyx_RaiseBufferIndexError(__pyx_t_52);
9794  __PYX_ERR(0, 354, __pyx_L1_error)
9795  }
9796  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_56, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_57, __pyx_pybuffernd_q_flin.diminfo[2].strides) += ((__pyx_v_rho * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_a_avg.diminfo[0].strides))) * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_gravity.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_gravity.diminfo[0].strides)));
9797  }
9798  }
9799  }
9800  }
9801 
9802  /* "subsurfaceTransportFunctions.pyx":301
9803  *
9804  * ##################################################
9805  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
9806  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
9807  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
9808  */
9809 
9810  /* function exit code */
9811  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9812  goto __pyx_L0;
9813  __pyx_L1_error:;
9814  __Pyx_XDECREF(__pyx_t_3);
9815  __Pyx_XDECREF(__pyx_t_4);
9816  __Pyx_XDECREF(__pyx_t_5);
9817  __Pyx_XDECREF(__pyx_t_6);
9818  __Pyx_XDECREF(__pyx_t_7);
9819  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
9820  __Pyx_PyThreadState_declare
9821  __Pyx_PyThreadState_assign
9822  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
9823  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_KWs.rcbuffer->pybuffer);
9824  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_avg.rcbuffer->pybuffer);
9825  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_eN.rcbuffer->pybuffer);
9826  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_neig.rcbuffer->pybuffer);
9827  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
9828  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
9829  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
9830  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
9831  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
9832  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
9833  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
9834  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
9835  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_Linear", __pyx_clineno, __pyx_lineno, __pyx_filename);
9836  __pyx_r = NULL;
9837  goto __pyx_L2;
9838  __pyx_L0:;
9839  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_KWs.rcbuffer->pybuffer);
9840  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_avg.rcbuffer->pybuffer);
9841  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_eN.rcbuffer->pybuffer);
9842  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_neig.rcbuffer->pybuffer);
9843  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
9844  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
9845  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
9846  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
9847  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
9848  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
9849  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
9850  __pyx_L2:;
9851  __Pyx_XDECREF((PyObject *)__pyx_v_a_eN);
9852  __Pyx_XDECREF((PyObject *)__pyx_v_a_neig);
9853  __Pyx_XDECREF((PyObject *)__pyx_v_a_avg);
9854  __Pyx_XGIVEREF(__pyx_r);
9855  __Pyx_RefNannyFinishContext();
9856  return __pyx_r;
9857 }
9858 
9859 /* "subsurfaceTransportFunctions.pyx":359
9860  *
9861  *
9862  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
9863  * double beta,
9864  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
9865  */
9866 
9867 /* Python wrapper */
9868 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
9869 static char __pyx_doc_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM[] = "\n routine for evaluating nodal coefficients in NCP1 approximation for conservative head formulation of Richards equation \n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n assumes slight compressiblity for now\n\n TODO:\n everything\n \n ";
9870 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM = {"RE_NCP1_evaluateElementCoefficients_VGM", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM};
9871 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9872  double __pyx_v_rho;
9873  double __pyx_v_beta;
9874  PyArrayObject *__pyx_v_gravity = 0;
9875  PyArrayObject *__pyx_v_alpha = 0;
9876  PyArrayObject *__pyx_v_n = 0;
9877  PyArrayObject *__pyx_v_thetaR = 0;
9878  PyArrayObject *__pyx_v_thetaSR = 0;
9879  int __pyx_v_nSpace;
9880  int __pyx_v_nElements_global;
9881  int __pyx_v_nElementBoundaries_element;
9882  PyArrayObject *__pyx_v_elementNeighborsArray = 0;
9883  PyArrayObject *__pyx_v_elementBarycentersArray = 0;
9884  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
9885  int __pyx_v_nDOF_trial_element;
9886  PyArrayObject *__pyx_v_u_l2g = 0;
9887  PyArrayObject *__pyx_v_u_dof = 0;
9888  CYTHON_UNUSED PyArrayObject *__pyx_v_q_x = 0;
9889  PyArrayObject *__pyx_v_q_u = 0;
9890  PyArrayObject *__pyx_v_q_mass = 0;
9891  PyArrayObject *__pyx_v_q_dmass = 0;
9892  PyArrayObject *__pyx_v_q_r = 0;
9893  PyArrayObject *__pyx_v_q_kr = 0;
9894  PyArrayObject *__pyx_v_q_dkr = 0;
9895  PyArrayObject *__pyx_v_q_kr_up = 0;
9896  PyObject *__pyx_r = 0;
9897  __Pyx_RefNannyDeclarations
9898  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_VGM (wrapper)", 0);
9899  {
9900  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rho,&__pyx_n_s_beta,&__pyx_n_s_gravity,&__pyx_n_s_alpha,&__pyx_n_s_n,&__pyx_n_s_thetaR,&__pyx_n_s_thetaSR,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_nDOF_trial_element,&__pyx_n_s_u_l2g,&__pyx_n_s_u_dof,&__pyx_n_s_q_x,&__pyx_n_s_q_u,&__pyx_n_s_q_mass,&__pyx_n_s_q_dmass,&__pyx_n_s_q_r,&__pyx_n_s_q_kr,&__pyx_n_s_q_dkr,&__pyx_n_s_q_kr_up,0};
9901  PyObject* values[24] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
9902  if (unlikely(__pyx_kwds)) {
9903  Py_ssize_t kw_args;
9904  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9905  switch (pos_args) {
9906  case 24: values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
9907  CYTHON_FALLTHROUGH;
9908  case 23: values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
9909  CYTHON_FALLTHROUGH;
9910  case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
9911  CYTHON_FALLTHROUGH;
9912  case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
9913  CYTHON_FALLTHROUGH;
9914  case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
9915  CYTHON_FALLTHROUGH;
9916  case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
9917  CYTHON_FALLTHROUGH;
9918  case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
9919  CYTHON_FALLTHROUGH;
9920  case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
9921  CYTHON_FALLTHROUGH;
9922  case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
9923  CYTHON_FALLTHROUGH;
9924  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
9925  CYTHON_FALLTHROUGH;
9926  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
9927  CYTHON_FALLTHROUGH;
9928  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
9929  CYTHON_FALLTHROUGH;
9930  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
9931  CYTHON_FALLTHROUGH;
9932  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
9933  CYTHON_FALLTHROUGH;
9934  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
9935  CYTHON_FALLTHROUGH;
9936  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
9937  CYTHON_FALLTHROUGH;
9938  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
9939  CYTHON_FALLTHROUGH;
9940  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
9941  CYTHON_FALLTHROUGH;
9942  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
9943  CYTHON_FALLTHROUGH;
9944  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
9945  CYTHON_FALLTHROUGH;
9946  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
9947  CYTHON_FALLTHROUGH;
9948  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9949  CYTHON_FALLTHROUGH;
9950  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9951  CYTHON_FALLTHROUGH;
9952  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9953  CYTHON_FALLTHROUGH;
9954  case 0: break;
9955  default: goto __pyx_L5_argtuple_error;
9956  }
9957  kw_args = PyDict_Size(__pyx_kwds);
9958  switch (pos_args) {
9959  case 0:
9960  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rho)) != 0)) kw_args--;
9961  else goto __pyx_L5_argtuple_error;
9962  CYTHON_FALLTHROUGH;
9963  case 1:
9964  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
9965  else {
9966  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 1); __PYX_ERR(0, 359, __pyx_L3_error)
9967  }
9968  CYTHON_FALLTHROUGH;
9969  case 2:
9970  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
9971  else {
9972  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 2); __PYX_ERR(0, 359, __pyx_L3_error)
9973  }
9974  CYTHON_FALLTHROUGH;
9975  case 3:
9976  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
9977  else {
9978  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 3); __PYX_ERR(0, 359, __pyx_L3_error)
9979  }
9980  CYTHON_FALLTHROUGH;
9981  case 4:
9982  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
9983  else {
9984  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 4); __PYX_ERR(0, 359, __pyx_L3_error)
9985  }
9986  CYTHON_FALLTHROUGH;
9987  case 5:
9988  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_thetaR)) != 0)) kw_args--;
9989  else {
9990  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 5); __PYX_ERR(0, 359, __pyx_L3_error)
9991  }
9992  CYTHON_FALLTHROUGH;
9993  case 6:
9994  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_thetaSR)) != 0)) kw_args--;
9995  else {
9996  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 6); __PYX_ERR(0, 359, __pyx_L3_error)
9997  }
9998  CYTHON_FALLTHROUGH;
9999  case 7:
10000  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
10001  else {
10002  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 7); __PYX_ERR(0, 359, __pyx_L3_error)
10003  }
10004  CYTHON_FALLTHROUGH;
10005  case 8:
10006  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
10007  else {
10008  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 8); __PYX_ERR(0, 359, __pyx_L3_error)
10009  }
10010  CYTHON_FALLTHROUGH;
10011  case 9:
10012  if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
10013  else {
10014  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 9); __PYX_ERR(0, 359, __pyx_L3_error)
10015  }
10016  CYTHON_FALLTHROUGH;
10017  case 10:
10018  if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
10019  else {
10020  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 10); __PYX_ERR(0, 359, __pyx_L3_error)
10021  }
10022  CYTHON_FALLTHROUGH;
10023  case 11:
10024  if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
10025  else {
10026  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 11); __PYX_ERR(0, 359, __pyx_L3_error)
10027  }
10028  CYTHON_FALLTHROUGH;
10029  case 12:
10030  if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
10031  else {
10032  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 12); __PYX_ERR(0, 359, __pyx_L3_error)
10033  }
10034  CYTHON_FALLTHROUGH;
10035  case 13:
10036  if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nDOF_trial_element)) != 0)) kw_args--;
10037  else {
10038  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 13); __PYX_ERR(0, 359, __pyx_L3_error)
10039  }
10040  CYTHON_FALLTHROUGH;
10041  case 14:
10042  if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_u_l2g)) != 0)) kw_args--;
10043  else {
10044  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 14); __PYX_ERR(0, 359, __pyx_L3_error)
10045  }
10046  CYTHON_FALLTHROUGH;
10047  case 15:
10048  if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_u_dof)) != 0)) kw_args--;
10049  else {
10050  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 15); __PYX_ERR(0, 359, __pyx_L3_error)
10051  }
10052  CYTHON_FALLTHROUGH;
10053  case 16:
10054  if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_x)) != 0)) kw_args--;
10055  else {
10056  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 16); __PYX_ERR(0, 359, __pyx_L3_error)
10057  }
10058  CYTHON_FALLTHROUGH;
10059  case 17:
10060  if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_u)) != 0)) kw_args--;
10061  else {
10062  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 17); __PYX_ERR(0, 359, __pyx_L3_error)
10063  }
10064  CYTHON_FALLTHROUGH;
10065  case 18:
10066  if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_mass)) != 0)) kw_args--;
10067  else {
10068  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 18); __PYX_ERR(0, 359, __pyx_L3_error)
10069  }
10070  CYTHON_FALLTHROUGH;
10071  case 19:
10072  if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_dmass)) != 0)) kw_args--;
10073  else {
10074  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 19); __PYX_ERR(0, 359, __pyx_L3_error)
10075  }
10076  CYTHON_FALLTHROUGH;
10077  case 20:
10078  if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_r)) != 0)) kw_args--;
10079  else {
10080  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 20); __PYX_ERR(0, 359, __pyx_L3_error)
10081  }
10082  CYTHON_FALLTHROUGH;
10083  case 21:
10084  if (likely((values[21] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr)) != 0)) kw_args--;
10085  else {
10086  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 21); __PYX_ERR(0, 359, __pyx_L3_error)
10087  }
10088  CYTHON_FALLTHROUGH;
10089  case 22:
10090  if (likely((values[22] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_dkr)) != 0)) kw_args--;
10091  else {
10092  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 22); __PYX_ERR(0, 359, __pyx_L3_error)
10093  }
10094  CYTHON_FALLTHROUGH;
10095  case 23:
10096  if (likely((values[23] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr_up)) != 0)) kw_args--;
10097  else {
10098  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 23); __PYX_ERR(0, 359, __pyx_L3_error)
10099  }
10100  }
10101  if (unlikely(kw_args > 0)) {
10102  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_evaluateElementCoefficients_VGM") < 0)) __PYX_ERR(0, 359, __pyx_L3_error)
10103  }
10104  } else if (PyTuple_GET_SIZE(__pyx_args) != 24) {
10105  goto __pyx_L5_argtuple_error;
10106  } else {
10107  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10108  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10109  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10110  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
10111  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
10112  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
10113  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
10114  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
10115  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
10116  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
10117  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
10118  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
10119  values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
10120  values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
10121  values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
10122  values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
10123  values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
10124  values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
10125  values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
10126  values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
10127  values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
10128  values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
10129  values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
10130  values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
10131  }
10132  __pyx_v_rho = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_rho == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 359, __pyx_L3_error)
10133  __pyx_v_beta = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 360, __pyx_L3_error)
10134  __pyx_v_gravity = ((PyArrayObject *)values[2]);
10135  __pyx_v_alpha = ((PyArrayObject *)values[3]);
10136  __pyx_v_n = ((PyArrayObject *)values[4]);
10137  __pyx_v_thetaR = ((PyArrayObject *)values[5]);
10138  __pyx_v_thetaSR = ((PyArrayObject *)values[6]);
10139  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 367, __pyx_L3_error)
10140  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 368, __pyx_L3_error)
10141  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 369, __pyx_L3_error)
10142  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[10]);
10143  __pyx_v_elementBarycentersArray = ((PyArrayObject *)values[11]);
10144  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[12]);
10145  __pyx_v_nDOF_trial_element = __Pyx_PyInt_As_int(values[13]); if (unlikely((__pyx_v_nDOF_trial_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 374, __pyx_L3_error)
10146  __pyx_v_u_l2g = ((PyArrayObject *)values[14]);
10147  __pyx_v_u_dof = ((PyArrayObject *)values[15]);
10148  __pyx_v_q_x = ((PyArrayObject *)values[16]);
10149  __pyx_v_q_u = ((PyArrayObject *)values[17]);
10150  __pyx_v_q_mass = ((PyArrayObject *)values[18]);
10151  __pyx_v_q_dmass = ((PyArrayObject *)values[19]);
10152  __pyx_v_q_r = ((PyArrayObject *)values[20]);
10153  __pyx_v_q_kr = ((PyArrayObject *)values[21]);
10154  __pyx_v_q_dkr = ((PyArrayObject *)values[22]);
10155  __pyx_v_q_kr_up = ((PyArrayObject *)values[23]);
10156  }
10157  goto __pyx_L4_argument_unpacking_done;
10158  __pyx_L5_argtuple_error:;
10159  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 359, __pyx_L3_error)
10160  __pyx_L3_error:;
10161  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_VGM", __pyx_clineno, __pyx_lineno, __pyx_filename);
10162  __Pyx_RefNannyFinishContext();
10163  return NULL;
10164  __pyx_L4_argument_unpacking_done:;
10165  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) __PYX_ERR(0, 361, __pyx_L1_error)
10166  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_alpha), __pyx_ptype_5numpy_ndarray, 1, "alpha", 0))) __PYX_ERR(0, 362, __pyx_L1_error)
10167  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n), __pyx_ptype_5numpy_ndarray, 1, "n", 0))) __PYX_ERR(0, 363, __pyx_L1_error)
10168  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thetaR), __pyx_ptype_5numpy_ndarray, 1, "thetaR", 0))) __PYX_ERR(0, 364, __pyx_L1_error)
10169  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thetaSR), __pyx_ptype_5numpy_ndarray, 1, "thetaSR", 0))) __PYX_ERR(0, 365, __pyx_L1_error)
10170  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) __PYX_ERR(0, 370, __pyx_L1_error)
10171  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_ptype_5numpy_ndarray, 1, "elementBarycentersArray", 0))) __PYX_ERR(0, 371, __pyx_L1_error)
10172  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 372, __pyx_L1_error)
10173  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_u_l2g), __pyx_ptype_5numpy_ndarray, 1, "u_l2g", 0))) __PYX_ERR(0, 375, __pyx_L1_error)
10174  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_u_dof), __pyx_ptype_5numpy_ndarray, 1, "u_dof", 0))) __PYX_ERR(0, 376, __pyx_L1_error)
10175  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_x), __pyx_ptype_5numpy_ndarray, 1, "q_x", 0))) __PYX_ERR(0, 378, __pyx_L1_error)
10176  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_u), __pyx_ptype_5numpy_ndarray, 1, "q_u", 0))) __PYX_ERR(0, 379, __pyx_L1_error)
10177  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_mass), __pyx_ptype_5numpy_ndarray, 1, "q_mass", 0))) __PYX_ERR(0, 380, __pyx_L1_error)
10178  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dmass), __pyx_ptype_5numpy_ndarray, 1, "q_dmass", 0))) __PYX_ERR(0, 381, __pyx_L1_error)
10179  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_r), __pyx_ptype_5numpy_ndarray, 1, "q_r", 0))) __PYX_ERR(0, 382, __pyx_L1_error)
10180  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr), __pyx_ptype_5numpy_ndarray, 1, "q_kr", 0))) __PYX_ERR(0, 383, __pyx_L1_error)
10181  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dkr), __pyx_ptype_5numpy_ndarray, 1, "q_dkr", 0))) __PYX_ERR(0, 384, __pyx_L1_error)
10182  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr_up), __pyx_ptype_5numpy_ndarray, 1, "q_kr_up", 0))) __PYX_ERR(0, 385, __pyx_L1_error)
10183  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM(__pyx_self, __pyx_v_rho, __pyx_v_beta, __pyx_v_gravity, __pyx_v_alpha, __pyx_v_n, __pyx_v_thetaR, __pyx_v_thetaSR, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementBarycentersArray, __pyx_v_elementMaterialTypes, __pyx_v_nDOF_trial_element, __pyx_v_u_l2g, __pyx_v_u_dof, __pyx_v_q_x, __pyx_v_q_u, __pyx_v_q_mass, __pyx_v_q_dmass, __pyx_v_q_r, __pyx_v_q_kr, __pyx_v_q_dkr, __pyx_v_q_kr_up);
10184 
10185  /* function exit code */
10186  goto __pyx_L0;
10187  __pyx_L1_error:;
10188  __pyx_r = NULL;
10189  __pyx_L0:;
10190  __Pyx_RefNannyFinishContext();
10191  return __pyx_r;
10192 }
10193 
10194 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, double __pyx_v_beta, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_alpha, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_thetaR, PyArrayObject *__pyx_v_thetaSR, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementBarycentersArray, PyArrayObject *__pyx_v_elementMaterialTypes, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_u_l2g, PyArrayObject *__pyx_v_u_dof, CYTHON_UNUSED PyArrayObject *__pyx_v_q_x, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_mass, PyArrayObject *__pyx_v_q_dmass, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up) {
10195  PyObject *__pyx_v_q = NULL;
10196  double __pyx_v_psiC;
10197  double __pyx_v_pcBar;
10198  double __pyx_v_pcBar_n;
10199  double __pyx_v_pcBar_nM1;
10200  double __pyx_v_pcBar_nM2;
10201  double __pyx_v_onePlus_pcBar_n;
10202  double __pyx_v_sBar;
10203  double __pyx_v_sqrt_sBar;
10204  double __pyx_v_DsBar_DpsiC;
10205  double __pyx_v_thetaW;
10206  double __pyx_v_DthetaW_DpsiC;
10207  double __pyx_v_vBar;
10208  double __pyx_v_vBar2;
10209  double __pyx_v_DvBar_DpsiC;
10210  double __pyx_v_KWr;
10211  double __pyx_v_DKWr_DpsiC;
10212  CYTHON_UNUSED double __pyx_v_rho2;
10213  double __pyx_v_thetaS;
10214  double __pyx_v_rhom;
10215  double __pyx_v_drhom;
10216  double __pyx_v_m;
10217  double __pyx_v_u_j;
10218  double __pyx_v_u_eN;
10219  double __pyx_v_u_neig;
10220  double __pyx_v_kr_eN;
10221  double __pyx_v_kr_neig;
10222  double __pyx_v_phi_eN;
10223  double __pyx_v_phi_neig;
10224  int __pyx_v_eN;
10225  int __pyx_v_eN_neighbor;
10226  int __pyx_v_ebN;
10227  int __pyx_v_j;
10228  int __pyx_v_matID;
10229  double __pyx_v_nAvgWeight;
10230  __Pyx_LocalBuf_ND __pyx_pybuffernd_alpha;
10231  __Pyx_Buffer __pyx_pybuffer_alpha;
10232  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBarycentersArray;
10233  __Pyx_Buffer __pyx_pybuffer_elementBarycentersArray;
10234  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
10235  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
10236  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
10237  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
10238  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
10239  __Pyx_Buffer __pyx_pybuffer_gravity;
10240  __Pyx_LocalBuf_ND __pyx_pybuffernd_n;
10241  __Pyx_Buffer __pyx_pybuffer_n;
10242  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dkr;
10243  __Pyx_Buffer __pyx_pybuffer_q_dkr;
10244  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dmass;
10245  __Pyx_Buffer __pyx_pybuffer_q_dmass;
10246  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr;
10247  __Pyx_Buffer __pyx_pybuffer_q_kr;
10248  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr_up;
10249  __Pyx_Buffer __pyx_pybuffer_q_kr_up;
10250  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_mass;
10251  __Pyx_Buffer __pyx_pybuffer_q_mass;
10252  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_r;
10253  __Pyx_Buffer __pyx_pybuffer_q_r;
10254  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_u;
10255  __Pyx_Buffer __pyx_pybuffer_q_u;
10256  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_x;
10257  __Pyx_Buffer __pyx_pybuffer_q_x;
10258  __Pyx_LocalBuf_ND __pyx_pybuffernd_thetaR;
10259  __Pyx_Buffer __pyx_pybuffer_thetaR;
10260  __Pyx_LocalBuf_ND __pyx_pybuffernd_thetaSR;
10261  __Pyx_Buffer __pyx_pybuffer_thetaSR;
10262  __Pyx_LocalBuf_ND __pyx_pybuffernd_u_dof;
10263  __Pyx_Buffer __pyx_pybuffer_u_dof;
10264  __Pyx_LocalBuf_ND __pyx_pybuffernd_u_l2g;
10265  __Pyx_Buffer __pyx_pybuffer_u_l2g;
10266  PyObject *__pyx_r = NULL;
10267  __Pyx_RefNannyDeclarations
10268  PyObject *__pyx_t_1 = NULL;
10269  PyObject *__pyx_t_2 = NULL;
10270  Py_ssize_t __pyx_t_3;
10271  PyObject *__pyx_t_4 = NULL;
10272  PyObject *__pyx_t_5 = NULL;
10273  int __pyx_t_6;
10274  double __pyx_t_7;
10275  int __pyx_t_8;
10276  int __pyx_t_9;
10277  int __pyx_t_10;
10278  Py_ssize_t __pyx_t_11;
10279  int __pyx_t_12;
10280  int __pyx_t_13;
10281  int __pyx_t_14;
10282  Py_ssize_t __pyx_t_15;
10283  Py_ssize_t __pyx_t_16;
10284  int __pyx_t_17;
10285  Py_ssize_t __pyx_t_18;
10286  Py_ssize_t __pyx_t_19;
10287  Py_ssize_t __pyx_t_20;
10288  Py_ssize_t __pyx_t_21;
10289  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_22;
10290  Py_ssize_t __pyx_t_23;
10291  Py_ssize_t __pyx_t_24;
10292  Py_ssize_t __pyx_t_25;
10293  Py_ssize_t __pyx_t_26;
10294  Py_ssize_t __pyx_t_27;
10295  Py_ssize_t __pyx_t_28;
10296  Py_ssize_t __pyx_t_29;
10297  Py_ssize_t __pyx_t_30;
10298  Py_ssize_t __pyx_t_31;
10299  Py_ssize_t __pyx_t_32;
10300  Py_ssize_t __pyx_t_33;
10301  Py_ssize_t __pyx_t_34;
10302  Py_ssize_t __pyx_t_35;
10303  Py_ssize_t __pyx_t_36;
10304  Py_ssize_t __pyx_t_37;
10305  Py_ssize_t __pyx_t_38;
10306  Py_ssize_t __pyx_t_39;
10307  Py_ssize_t __pyx_t_40;
10308  Py_ssize_t __pyx_t_41;
10309  PyObject *__pyx_t_42 = NULL;
10310  PyObject *__pyx_t_43 = NULL;
10311  Py_ssize_t __pyx_t_44;
10312  Py_ssize_t __pyx_t_45;
10313  Py_ssize_t __pyx_t_46;
10314  Py_ssize_t __pyx_t_47;
10315  Py_ssize_t __pyx_t_48;
10316  Py_ssize_t __pyx_t_49;
10317  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_VGM", 0);
10318  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
10319  __pyx_pybuffer_gravity.refcount = 0;
10320  __pyx_pybuffernd_gravity.data = NULL;
10321  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
10322  __pyx_pybuffer_alpha.pybuffer.buf = NULL;
10323  __pyx_pybuffer_alpha.refcount = 0;
10324  __pyx_pybuffernd_alpha.data = NULL;
10325  __pyx_pybuffernd_alpha.rcbuffer = &__pyx_pybuffer_alpha;
10326  __pyx_pybuffer_n.pybuffer.buf = NULL;
10327  __pyx_pybuffer_n.refcount = 0;
10328  __pyx_pybuffernd_n.data = NULL;
10329  __pyx_pybuffernd_n.rcbuffer = &__pyx_pybuffer_n;
10330  __pyx_pybuffer_thetaR.pybuffer.buf = NULL;
10331  __pyx_pybuffer_thetaR.refcount = 0;
10332  __pyx_pybuffernd_thetaR.data = NULL;
10333  __pyx_pybuffernd_thetaR.rcbuffer = &__pyx_pybuffer_thetaR;
10334  __pyx_pybuffer_thetaSR.pybuffer.buf = NULL;
10335  __pyx_pybuffer_thetaSR.refcount = 0;
10336  __pyx_pybuffernd_thetaSR.data = NULL;
10337  __pyx_pybuffernd_thetaSR.rcbuffer = &__pyx_pybuffer_thetaSR;
10338  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
10339  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
10340  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
10341  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
10342  __pyx_pybuffer_elementBarycentersArray.pybuffer.buf = NULL;
10343  __pyx_pybuffer_elementBarycentersArray.refcount = 0;
10344  __pyx_pybuffernd_elementBarycentersArray.data = NULL;
10345  __pyx_pybuffernd_elementBarycentersArray.rcbuffer = &__pyx_pybuffer_elementBarycentersArray;
10346  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
10347  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
10348  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
10349  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
10350  __pyx_pybuffer_u_l2g.pybuffer.buf = NULL;
10351  __pyx_pybuffer_u_l2g.refcount = 0;
10352  __pyx_pybuffernd_u_l2g.data = NULL;
10353  __pyx_pybuffernd_u_l2g.rcbuffer = &__pyx_pybuffer_u_l2g;
10354  __pyx_pybuffer_u_dof.pybuffer.buf = NULL;
10355  __pyx_pybuffer_u_dof.refcount = 0;
10356  __pyx_pybuffernd_u_dof.data = NULL;
10357  __pyx_pybuffernd_u_dof.rcbuffer = &__pyx_pybuffer_u_dof;
10358  __pyx_pybuffer_q_x.pybuffer.buf = NULL;
10359  __pyx_pybuffer_q_x.refcount = 0;
10360  __pyx_pybuffernd_q_x.data = NULL;
10361  __pyx_pybuffernd_q_x.rcbuffer = &__pyx_pybuffer_q_x;
10362  __pyx_pybuffer_q_u.pybuffer.buf = NULL;
10363  __pyx_pybuffer_q_u.refcount = 0;
10364  __pyx_pybuffernd_q_u.data = NULL;
10365  __pyx_pybuffernd_q_u.rcbuffer = &__pyx_pybuffer_q_u;
10366  __pyx_pybuffer_q_mass.pybuffer.buf = NULL;
10367  __pyx_pybuffer_q_mass.refcount = 0;
10368  __pyx_pybuffernd_q_mass.data = NULL;
10369  __pyx_pybuffernd_q_mass.rcbuffer = &__pyx_pybuffer_q_mass;
10370  __pyx_pybuffer_q_dmass.pybuffer.buf = NULL;
10371  __pyx_pybuffer_q_dmass.refcount = 0;
10372  __pyx_pybuffernd_q_dmass.data = NULL;
10373  __pyx_pybuffernd_q_dmass.rcbuffer = &__pyx_pybuffer_q_dmass;
10374  __pyx_pybuffer_q_r.pybuffer.buf = NULL;
10375  __pyx_pybuffer_q_r.refcount = 0;
10376  __pyx_pybuffernd_q_r.data = NULL;
10377  __pyx_pybuffernd_q_r.rcbuffer = &__pyx_pybuffer_q_r;
10378  __pyx_pybuffer_q_kr.pybuffer.buf = NULL;
10379  __pyx_pybuffer_q_kr.refcount = 0;
10380  __pyx_pybuffernd_q_kr.data = NULL;
10381  __pyx_pybuffernd_q_kr.rcbuffer = &__pyx_pybuffer_q_kr;
10382  __pyx_pybuffer_q_dkr.pybuffer.buf = NULL;
10383  __pyx_pybuffer_q_dkr.refcount = 0;
10384  __pyx_pybuffernd_q_dkr.data = NULL;
10385  __pyx_pybuffernd_q_dkr.rcbuffer = &__pyx_pybuffer_q_dkr;
10386  __pyx_pybuffer_q_kr_up.pybuffer.buf = NULL;
10387  __pyx_pybuffer_q_kr_up.refcount = 0;
10388  __pyx_pybuffernd_q_kr_up.data = NULL;
10389  __pyx_pybuffernd_q_kr_up.rcbuffer = &__pyx_pybuffer_q_kr_up;
10390  {
10391  __Pyx_BufFmt_StackElem __pyx_stack[1];
10392  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10393  }
10394  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
10395  {
10396  __Pyx_BufFmt_StackElem __pyx_stack[1];
10397  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer, (PyObject*)__pyx_v_alpha, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10398  }
10399  __pyx_pybuffernd_alpha.diminfo[0].strides = __pyx_pybuffernd_alpha.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_alpha.diminfo[0].shape = __pyx_pybuffernd_alpha.rcbuffer->pybuffer.shape[0];
10400  {
10401  __Pyx_BufFmt_StackElem __pyx_stack[1];
10402  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_n, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10403  }
10404  __pyx_pybuffernd_n.diminfo[0].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_n.diminfo[0].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[0];
10405  {
10406  __Pyx_BufFmt_StackElem __pyx_stack[1];
10407  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_thetaR.rcbuffer->pybuffer, (PyObject*)__pyx_v_thetaR, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10408  }
10409  __pyx_pybuffernd_thetaR.diminfo[0].strides = __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_thetaR.diminfo[0].shape = __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.shape[0];
10410  {
10411  __Pyx_BufFmt_StackElem __pyx_stack[1];
10412  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_thetaSR.rcbuffer->pybuffer, (PyObject*)__pyx_v_thetaSR, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10413  }
10414  __pyx_pybuffernd_thetaSR.diminfo[0].strides = __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_thetaSR.diminfo[0].shape = __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.shape[0];
10415  {
10416  __Pyx_BufFmt_StackElem __pyx_stack[1];
10417  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10418  }
10419  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
10420  {
10421  __Pyx_BufFmt_StackElem __pyx_stack[1];
10422  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBarycentersArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10423  }
10424  __pyx_pybuffernd_elementBarycentersArray.diminfo[0].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[0].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[1];
10425  {
10426  __Pyx_BufFmt_StackElem __pyx_stack[1];
10427  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10428  }
10429  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
10430  {
10431  __Pyx_BufFmt_StackElem __pyx_stack[1];
10432  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_u_l2g.rcbuffer->pybuffer, (PyObject*)__pyx_v_u_l2g, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10433  }
10434  __pyx_pybuffernd_u_l2g.diminfo[0].strides = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_u_l2g.diminfo[0].shape = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_u_l2g.diminfo[1].strides = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_u_l2g.diminfo[1].shape = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.shape[1];
10435  {
10436  __Pyx_BufFmt_StackElem __pyx_stack[1];
10437  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_u_dof.rcbuffer->pybuffer, (PyObject*)__pyx_v_u_dof, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10438  }
10439  __pyx_pybuffernd_u_dof.diminfo[0].strides = __pyx_pybuffernd_u_dof.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_u_dof.diminfo[0].shape = __pyx_pybuffernd_u_dof.rcbuffer->pybuffer.shape[0];
10440  {
10441  __Pyx_BufFmt_StackElem __pyx_stack[1];
10442  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10443  }
10444  __pyx_pybuffernd_q_x.diminfo[0].strides = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_x.diminfo[0].shape = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_x.diminfo[1].strides = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_x.diminfo[1].shape = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_x.diminfo[2].strides = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_x.diminfo[2].shape = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.shape[2];
10445  {
10446  __Pyx_BufFmt_StackElem __pyx_stack[1];
10447  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10448  }
10449  __pyx_pybuffernd_q_u.diminfo[0].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_u.diminfo[0].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_u.diminfo[1].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_u.diminfo[1].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[1];
10450  {
10451  __Pyx_BufFmt_StackElem __pyx_stack[1];
10452  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_mass.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_mass, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10453  }
10454  __pyx_pybuffernd_q_mass.diminfo[0].strides = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_mass.diminfo[0].shape = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_mass.diminfo[1].strides = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_mass.diminfo[1].shape = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.shape[1];
10455  {
10456  __Pyx_BufFmt_StackElem __pyx_stack[1];
10457  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dmass.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dmass, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10458  }
10459  __pyx_pybuffernd_q_dmass.diminfo[0].strides = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dmass.diminfo[0].shape = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dmass.diminfo[1].strides = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dmass.diminfo[1].shape = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.shape[1];
10460  {
10461  __Pyx_BufFmt_StackElem __pyx_stack[1];
10462  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_r, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10463  }
10464  __pyx_pybuffernd_q_r.diminfo[0].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_r.diminfo[0].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_r.diminfo[1].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_r.diminfo[1].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[1];
10465  {
10466  __Pyx_BufFmt_StackElem __pyx_stack[1];
10467  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10468  }
10469  __pyx_pybuffernd_q_kr.diminfo[0].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr.diminfo[0].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr.diminfo[1].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr.diminfo[1].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[1];
10470  {
10471  __Pyx_BufFmt_StackElem __pyx_stack[1];
10472  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dkr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10473  }
10474  __pyx_pybuffernd_q_dkr.diminfo[0].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dkr.diminfo[0].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dkr.diminfo[1].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dkr.diminfo[1].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[1];
10475  {
10476  __Pyx_BufFmt_StackElem __pyx_stack[1];
10477  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr_up, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10478  }
10479  __pyx_pybuffernd_q_kr_up.diminfo[0].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr_up.diminfo[0].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr_up.diminfo[1].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr_up.diminfo[1].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[1];
10480 
10481  /* "subsurfaceTransportFunctions.pyx":399
10482  * """
10483  * #check some sizes
10484  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]: # <<<<<<<<<<<<<<
10485  * assert q.shape[1] == nSpace+1
10486  * assert nDOF_trial_element == nSpace + 1
10487  */
10488  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error)
10489  __Pyx_GOTREF(__pyx_t_1);
10490  __Pyx_INCREF(((PyObject *)__pyx_v_q_u));
10491  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_u));
10492  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_q_u));
10493  __Pyx_INCREF(((PyObject *)__pyx_v_q_mass));
10494  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_mass));
10495  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_q_mass));
10496  __Pyx_INCREF(((PyObject *)__pyx_v_q_r));
10497  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_r));
10498  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_q_r));
10499  __Pyx_INCREF(((PyObject *)__pyx_v_q_kr));
10500  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_kr));
10501  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_q_kr));
10502  __Pyx_INCREF(((PyObject *)__pyx_v_q_dkr));
10503  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_dkr));
10504  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_q_dkr));
10505  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
10506  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10507  for (;;) {
10508  if (__pyx_t_3 >= 5) break;
10509  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10510  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 399, __pyx_L1_error)
10511  #else
10512  __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error)
10513  __Pyx_GOTREF(__pyx_t_1);
10514  #endif
10515  __Pyx_XDECREF_SET(__pyx_v_q, __pyx_t_1);
10516  __pyx_t_1 = 0;
10517 
10518  /* "subsurfaceTransportFunctions.pyx":400
10519  * #check some sizes
10520  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]:
10521  * assert q.shape[1] == nSpace+1 # <<<<<<<<<<<<<<
10522  * assert nDOF_trial_element == nSpace + 1
10523  * #temporaries
10524  */
10525  #ifndef CYTHON_WITHOUT_ASSERTIONS
10526  if (unlikely(!Py_OptimizeFlag)) {
10527  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_q, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L1_error)
10528  __Pyx_GOTREF(__pyx_t_1);
10529  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 400, __pyx_L1_error)
10530  __Pyx_GOTREF(__pyx_t_4);
10531  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10532  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_nSpace + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L1_error)
10533  __Pyx_GOTREF(__pyx_t_1);
10534  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 400, __pyx_L1_error)
10535  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10536  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10537  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 400, __pyx_L1_error)
10538  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10539  if (unlikely(!__pyx_t_6)) {
10540  PyErr_SetNone(PyExc_AssertionError);
10541  __PYX_ERR(0, 400, __pyx_L1_error)
10542  }
10543  }
10544  #endif
10545 
10546  /* "subsurfaceTransportFunctions.pyx":399
10547  * """
10548  * #check some sizes
10549  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]: # <<<<<<<<<<<<<<
10550  * assert q.shape[1] == nSpace+1
10551  * assert nDOF_trial_element == nSpace + 1
10552  */
10553  }
10554  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10555 
10556  /* "subsurfaceTransportFunctions.pyx":401
10557  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]:
10558  * assert q.shape[1] == nSpace+1
10559  * assert nDOF_trial_element == nSpace + 1 # <<<<<<<<<<<<<<
10560  * #temporaries
10561  * cdef double psiC,pcBar,pcBar_n,pcBar_nM1,pcBar_nM2,onePlus_pcBar_n,sBar,sqrt_sBar,DsBar_DpsiC,thetaW,DthetaW_DpsiC
10562  */
10563  #ifndef CYTHON_WITHOUT_ASSERTIONS
10564  if (unlikely(!Py_OptimizeFlag)) {
10565  if (unlikely(!((__pyx_v_nDOF_trial_element == (__pyx_v_nSpace + 1)) != 0))) {
10566  PyErr_SetNone(PyExc_AssertionError);
10567  __PYX_ERR(0, 401, __pyx_L1_error)
10568  }
10569  }
10570  #endif
10571 
10572  /* "subsurfaceTransportFunctions.pyx":404
10573  * #temporaries
10574  * cdef double psiC,pcBar,pcBar_n,pcBar_nM1,pcBar_nM2,onePlus_pcBar_n,sBar,sqrt_sBar,DsBar_DpsiC,thetaW,DthetaW_DpsiC
10575  * cdef double vBar,vBar2,DvBar_DpsiC,KWr,DKWr_DpsiC,rho2=rho*rho,thetaS,rhom,drhom,m # <<<<<<<<<<<<<<
10576  *
10577  * cdef double u_j,u_eN,u_neig,kr_eN,kr_neig,phi_eN,phi_neig
10578  */
10579  __pyx_v_rho2 = (__pyx_v_rho * __pyx_v_rho);
10580 
10581  /* "subsurfaceTransportFunctions.pyx":409
10582  * cdef int eN,eN_neighbor,ebN,ii,I,j,matID
10583  * #for averaging/integration weights
10584  * cdef double nAvgWeight = 1.0/(nSpace+1.) # <<<<<<<<<<<<<<
10585  *
10586  * #loop through and evaluate
10587  */
10588  __pyx_t_7 = (__pyx_v_nSpace + 1.);
10589  if (unlikely(__pyx_t_7 == 0)) {
10590  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
10591  __PYX_ERR(0, 409, __pyx_L1_error)
10592  }
10593  __pyx_v_nAvgWeight = (1.0 / __pyx_t_7);
10594 
10595  /* "subsurfaceTransportFunctions.pyx":412
10596  *
10597  * #loop through and evaluate
10598  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
10599  * matID = elementMaterialTypes[eN]
10600  * for j in range(nDOF_trial_element):
10601  */
10602  __pyx_t_8 = __pyx_v_nElements_global;
10603  __pyx_t_9 = __pyx_t_8;
10604  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
10605  __pyx_v_eN = __pyx_t_10;
10606 
10607  /* "subsurfaceTransportFunctions.pyx":413
10608  * #loop through and evaluate
10609  * for eN in range(nElements_global):
10610  * matID = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
10611  * for j in range(nDOF_trial_element):
10612  * u_j = u_dof[u_l2g[eN,j]]
10613  */
10614  __pyx_t_11 = __pyx_v_eN;
10615  __pyx_t_12 = -1;
10616  if (__pyx_t_11 < 0) {
10617  __pyx_t_11 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
10618  if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 0;
10619  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_12 = 0;
10620  if (unlikely(__pyx_t_12 != -1)) {
10621  __Pyx_RaiseBufferIndexError(__pyx_t_12);
10622  __PYX_ERR(0, 413, __pyx_L1_error)
10623  }
10624  __pyx_v_matID = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
10625 
10626  /* "subsurfaceTransportFunctions.pyx":414
10627  * for eN in range(nElements_global):
10628  * matID = elementMaterialTypes[eN]
10629  * for j in range(nDOF_trial_element): # <<<<<<<<<<<<<<
10630  * u_j = u_dof[u_l2g[eN,j]]
10631  * q_u[eN,j] = u_j
10632  */
10633  __pyx_t_12 = __pyx_v_nDOF_trial_element;
10634  __pyx_t_13 = __pyx_t_12;
10635  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
10636  __pyx_v_j = __pyx_t_14;
10637 
10638  /* "subsurfaceTransportFunctions.pyx":415
10639  * matID = elementMaterialTypes[eN]
10640  * for j in range(nDOF_trial_element):
10641  * u_j = u_dof[u_l2g[eN,j]] # <<<<<<<<<<<<<<
10642  * q_u[eN,j] = u_j
10643  *
10644  */
10645  __pyx_t_15 = __pyx_v_eN;
10646  __pyx_t_16 = __pyx_v_j;
10647  __pyx_t_17 = -1;
10648  if (__pyx_t_15 < 0) {
10649  __pyx_t_15 += __pyx_pybuffernd_u_l2g.diminfo[0].shape;
10650  if (unlikely(__pyx_t_15 < 0)) __pyx_t_17 = 0;
10651  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_u_l2g.diminfo[0].shape)) __pyx_t_17 = 0;
10652  if (__pyx_t_16 < 0) {
10653  __pyx_t_16 += __pyx_pybuffernd_u_l2g.diminfo[1].shape;
10654  if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 1;
10655  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_u_l2g.diminfo[1].shape)) __pyx_t_17 = 1;
10656  if (unlikely(__pyx_t_17 != -1)) {
10657  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10658  __PYX_ERR(0, 415, __pyx_L1_error)
10659  }
10660  __pyx_t_18 = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_u_l2g.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_u_l2g.diminfo[1].strides));
10661  __pyx_t_17 = -1;
10662  if (__pyx_t_18 < 0) {
10663  __pyx_t_18 += __pyx_pybuffernd_u_dof.diminfo[0].shape;
10664  if (unlikely(__pyx_t_18 < 0)) __pyx_t_17 = 0;
10665  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_u_dof.diminfo[0].shape)) __pyx_t_17 = 0;
10666  if (unlikely(__pyx_t_17 != -1)) {
10667  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10668  __PYX_ERR(0, 415, __pyx_L1_error)
10669  }
10670  __pyx_v_u_j = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_u_dof.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_u_dof.diminfo[0].strides));
10671 
10672  /* "subsurfaceTransportFunctions.pyx":416
10673  * for j in range(nDOF_trial_element):
10674  * u_j = u_dof[u_l2g[eN,j]]
10675  * q_u[eN,j] = u_j # <<<<<<<<<<<<<<
10676  *
10677  * #VGM evaluation
10678  */
10679  __pyx_t_19 = __pyx_v_eN;
10680  __pyx_t_20 = __pyx_v_j;
10681  __pyx_t_17 = -1;
10682  if (__pyx_t_19 < 0) {
10683  __pyx_t_19 += __pyx_pybuffernd_q_u.diminfo[0].shape;
10684  if (unlikely(__pyx_t_19 < 0)) __pyx_t_17 = 0;
10685  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_q_u.diminfo[0].shape)) __pyx_t_17 = 0;
10686  if (__pyx_t_20 < 0) {
10687  __pyx_t_20 += __pyx_pybuffernd_q_u.diminfo[1].shape;
10688  if (unlikely(__pyx_t_20 < 0)) __pyx_t_17 = 1;
10689  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_q_u.diminfo[1].shape)) __pyx_t_17 = 1;
10690  if (unlikely(__pyx_t_17 != -1)) {
10691  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10692  __PYX_ERR(0, 416, __pyx_L1_error)
10693  }
10694  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_u.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_q_u.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_q_u.diminfo[1].strides) = __pyx_v_u_j;
10695 
10696  /* "subsurfaceTransportFunctions.pyx":419
10697  *
10698  * #VGM evaluation
10699  * psiC = -u_j # <<<<<<<<<<<<<<
10700  * m = 1.0 - 1.0/n[matID]
10701  * thetaS = thetaR[matID] + thetaSR[matID]
10702  */
10703  __pyx_v_psiC = (-__pyx_v_u_j);
10704 
10705  /* "subsurfaceTransportFunctions.pyx":420
10706  * #VGM evaluation
10707  * psiC = -u_j
10708  * m = 1.0 - 1.0/n[matID] # <<<<<<<<<<<<<<
10709  * thetaS = thetaR[matID] + thetaSR[matID]
10710  * if psiC > 0.0:
10711  */
10712  __pyx_t_21 = __pyx_v_matID;
10713  __pyx_t_17 = -1;
10714  if (__pyx_t_21 < 0) {
10715  __pyx_t_21 += __pyx_pybuffernd_n.diminfo[0].shape;
10716  if (unlikely(__pyx_t_21 < 0)) __pyx_t_17 = 0;
10717  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_17 = 0;
10718  if (unlikely(__pyx_t_17 != -1)) {
10719  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10720  __PYX_ERR(0, 420, __pyx_L1_error)
10721  }
10722  __pyx_t_22 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_n.diminfo[0].strides));
10723  if (unlikely(__pyx_t_22 == 0)) {
10724  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
10725  __PYX_ERR(0, 420, __pyx_L1_error)
10726  }
10727  __pyx_v_m = (1.0 - (1.0 / __pyx_t_22));
10728 
10729  /* "subsurfaceTransportFunctions.pyx":421
10730  * psiC = -u_j
10731  * m = 1.0 - 1.0/n[matID]
10732  * thetaS = thetaR[matID] + thetaSR[matID] # <<<<<<<<<<<<<<
10733  * if psiC > 0.0:
10734  * pcBar = alpha[matID]*psiC
10735  */
10736  __pyx_t_23 = __pyx_v_matID;
10737  __pyx_t_17 = -1;
10738  if (__pyx_t_23 < 0) {
10739  __pyx_t_23 += __pyx_pybuffernd_thetaR.diminfo[0].shape;
10740  if (unlikely(__pyx_t_23 < 0)) __pyx_t_17 = 0;
10741  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_thetaR.diminfo[0].shape)) __pyx_t_17 = 0;
10742  if (unlikely(__pyx_t_17 != -1)) {
10743  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10744  __PYX_ERR(0, 421, __pyx_L1_error)
10745  }
10746  __pyx_t_24 = __pyx_v_matID;
10747  __pyx_t_17 = -1;
10748  if (__pyx_t_24 < 0) {
10749  __pyx_t_24 += __pyx_pybuffernd_thetaSR.diminfo[0].shape;
10750  if (unlikely(__pyx_t_24 < 0)) __pyx_t_17 = 0;
10751  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_thetaSR.diminfo[0].shape)) __pyx_t_17 = 0;
10752  if (unlikely(__pyx_t_17 != -1)) {
10753  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10754  __PYX_ERR(0, 421, __pyx_L1_error)
10755  }
10756  __pyx_v_thetaS = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_thetaR.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_thetaSR.diminfo[0].strides)));
10757 
10758  /* "subsurfaceTransportFunctions.pyx":422
10759  * m = 1.0 - 1.0/n[matID]
10760  * thetaS = thetaR[matID] + thetaSR[matID]
10761  * if psiC > 0.0: # <<<<<<<<<<<<<<
10762  * pcBar = alpha[matID]*psiC
10763  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10764  */
10765  __pyx_t_6 = ((__pyx_v_psiC > 0.0) != 0);
10766  if (__pyx_t_6) {
10767 
10768  /* "subsurfaceTransportFunctions.pyx":423
10769  * thetaS = thetaR[matID] + thetaSR[matID]
10770  * if psiC > 0.0:
10771  * pcBar = alpha[matID]*psiC # <<<<<<<<<<<<<<
10772  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10773  * pcBar_nM1 = pcBar_nM2*pcBar
10774  */
10775  __pyx_t_25 = __pyx_v_matID;
10776  __pyx_t_17 = -1;
10777  if (__pyx_t_25 < 0) {
10778  __pyx_t_25 += __pyx_pybuffernd_alpha.diminfo[0].shape;
10779  if (unlikely(__pyx_t_25 < 0)) __pyx_t_17 = 0;
10780  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_alpha.diminfo[0].shape)) __pyx_t_17 = 0;
10781  if (unlikely(__pyx_t_17 != -1)) {
10782  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10783  __PYX_ERR(0, 423, __pyx_L1_error)
10784  }
10785  __pyx_v_pcBar = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_alpha.diminfo[0].strides)) * __pyx_v_psiC);
10786 
10787  /* "subsurfaceTransportFunctions.pyx":424
10788  * if psiC > 0.0:
10789  * pcBar = alpha[matID]*psiC
10790  * pcBar_nM2 = pow(pcBar,n[matID]-2) # <<<<<<<<<<<<<<
10791  * pcBar_nM1 = pcBar_nM2*pcBar
10792  * pcBar_n = pcBar_nM1*pcBar
10793  */
10794  __pyx_t_26 = __pyx_v_matID;
10795  __pyx_t_17 = -1;
10796  if (__pyx_t_26 < 0) {
10797  __pyx_t_26 += __pyx_pybuffernd_n.diminfo[0].shape;
10798  if (unlikely(__pyx_t_26 < 0)) __pyx_t_17 = 0;
10799  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_17 = 0;
10800  if (unlikely(__pyx_t_17 != -1)) {
10801  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10802  __PYX_ERR(0, 424, __pyx_L1_error)
10803  }
10804  __pyx_v_pcBar_nM2 = pow(__pyx_v_pcBar, ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_n.diminfo[0].strides)) - 2.0));
10805 
10806  /* "subsurfaceTransportFunctions.pyx":425
10807  * pcBar = alpha[matID]*psiC
10808  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10809  * pcBar_nM1 = pcBar_nM2*pcBar # <<<<<<<<<<<<<<
10810  * pcBar_n = pcBar_nM1*pcBar
10811  * onePlus_pcBar_n = 1.0 + pcBar_n
10812  */
10813  __pyx_v_pcBar_nM1 = (__pyx_v_pcBar_nM2 * __pyx_v_pcBar);
10814 
10815  /* "subsurfaceTransportFunctions.pyx":426
10816  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10817  * pcBar_nM1 = pcBar_nM2*pcBar
10818  * pcBar_n = pcBar_nM1*pcBar # <<<<<<<<<<<<<<
10819  * onePlus_pcBar_n = 1.0 + pcBar_n
10820  *
10821  */
10822  __pyx_v_pcBar_n = (__pyx_v_pcBar_nM1 * __pyx_v_pcBar);
10823 
10824  /* "subsurfaceTransportFunctions.pyx":427
10825  * pcBar_nM1 = pcBar_nM2*pcBar
10826  * pcBar_n = pcBar_nM1*pcBar
10827  * onePlus_pcBar_n = 1.0 + pcBar_n # <<<<<<<<<<<<<<
10828  *
10829  * sBar = pow(onePlus_pcBar_n,-m)
10830  */
10831  __pyx_v_onePlus_pcBar_n = (1.0 + __pyx_v_pcBar_n);
10832 
10833  /* "subsurfaceTransportFunctions.pyx":429
10834  * onePlus_pcBar_n = 1.0 + pcBar_n
10835  *
10836  * sBar = pow(onePlus_pcBar_n,-m) # <<<<<<<<<<<<<<
10837  * # using -mn = 1-n
10838  * DsBar_DpsiC = alpha[matID]*(1.0-n[matID])*(sBar/onePlus_pcBar_n)*pcBar_nM1
10839  */
10840  __pyx_v_sBar = pow(__pyx_v_onePlus_pcBar_n, (-__pyx_v_m));
10841 
10842  /* "subsurfaceTransportFunctions.pyx":431
10843  * sBar = pow(onePlus_pcBar_n,-m)
10844  * # using -mn = 1-n
10845  * DsBar_DpsiC = alpha[matID]*(1.0-n[matID])*(sBar/onePlus_pcBar_n)*pcBar_nM1 # <<<<<<<<<<<<<<
10846  *
10847  * vBar = 1.0-pcBar_nM1*sBar
10848  */
10849  __pyx_t_27 = __pyx_v_matID;
10850  __pyx_t_17 = -1;
10851  if (__pyx_t_27 < 0) {
10852  __pyx_t_27 += __pyx_pybuffernd_alpha.diminfo[0].shape;
10853  if (unlikely(__pyx_t_27 < 0)) __pyx_t_17 = 0;
10854  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_alpha.diminfo[0].shape)) __pyx_t_17 = 0;
10855  if (unlikely(__pyx_t_17 != -1)) {
10856  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10857  __PYX_ERR(0, 431, __pyx_L1_error)
10858  }
10859  __pyx_t_28 = __pyx_v_matID;
10860  __pyx_t_17 = -1;
10861  if (__pyx_t_28 < 0) {
10862  __pyx_t_28 += __pyx_pybuffernd_n.diminfo[0].shape;
10863  if (unlikely(__pyx_t_28 < 0)) __pyx_t_17 = 0;
10864  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_17 = 0;
10865  if (unlikely(__pyx_t_17 != -1)) {
10866  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10867  __PYX_ERR(0, 431, __pyx_L1_error)
10868  }
10869  if (unlikely(__pyx_v_onePlus_pcBar_n == 0)) {
10870  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
10871  __PYX_ERR(0, 431, __pyx_L1_error)
10872  }
10873  __pyx_v_DsBar_DpsiC = ((((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_alpha.diminfo[0].strides)) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_n.diminfo[0].strides)))) * (__pyx_v_sBar / __pyx_v_onePlus_pcBar_n)) * __pyx_v_pcBar_nM1);
10874 
10875  /* "subsurfaceTransportFunctions.pyx":433
10876  * DsBar_DpsiC = alpha[matID]*(1.0-n[matID])*(sBar/onePlus_pcBar_n)*pcBar_nM1
10877  *
10878  * vBar = 1.0-pcBar_nM1*sBar # <<<<<<<<<<<<<<
10879  * vBar2 = vBar*vBar
10880  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC
10881  */
10882  __pyx_v_vBar = (1.0 - (__pyx_v_pcBar_nM1 * __pyx_v_sBar));
10883 
10884  /* "subsurfaceTransportFunctions.pyx":434
10885  *
10886  * vBar = 1.0-pcBar_nM1*sBar
10887  * vBar2 = vBar*vBar # <<<<<<<<<<<<<<
10888  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC
10889  *
10890  */
10891  __pyx_v_vBar2 = (__pyx_v_vBar * __pyx_v_vBar);
10892 
10893  /* "subsurfaceTransportFunctions.pyx":435
10894  * vBar = 1.0-pcBar_nM1*sBar
10895  * vBar2 = vBar*vBar
10896  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC # <<<<<<<<<<<<<<
10897  *
10898  * thetaW = thetaSR[matID]*sBar + thetaR[matID]
10899  */
10900  __pyx_t_29 = __pyx_v_matID;
10901  __pyx_t_17 = -1;
10902  if (__pyx_t_29 < 0) {
10903  __pyx_t_29 += __pyx_pybuffernd_alpha.diminfo[0].shape;
10904  if (unlikely(__pyx_t_29 < 0)) __pyx_t_17 = 0;
10905  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_alpha.diminfo[0].shape)) __pyx_t_17 = 0;
10906  if (unlikely(__pyx_t_17 != -1)) {
10907  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10908  __PYX_ERR(0, 435, __pyx_L1_error)
10909  }
10910  __pyx_t_30 = __pyx_v_matID;
10911  __pyx_t_17 = -1;
10912  if (__pyx_t_30 < 0) {
10913  __pyx_t_30 += __pyx_pybuffernd_n.diminfo[0].shape;
10914  if (unlikely(__pyx_t_30 < 0)) __pyx_t_17 = 0;
10915  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_17 = 0;
10916  if (unlikely(__pyx_t_17 != -1)) {
10917  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10918  __PYX_ERR(0, 435, __pyx_L1_error)
10919  }
10920  __pyx_v_DvBar_DpsiC = (((((-(*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_alpha.diminfo[0].strides))) * ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_n.diminfo[0].strides)) - 1.0)) * __pyx_v_pcBar_nM2) * __pyx_v_sBar) - (__pyx_v_pcBar_nM1 * __pyx_v_DsBar_DpsiC));
10921 
10922  /* "subsurfaceTransportFunctions.pyx":437
10923  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC
10924  *
10925  * thetaW = thetaSR[matID]*sBar + thetaR[matID] # <<<<<<<<<<<<<<
10926  * DthetaW_DpsiC = thetaSR[matID] * DsBar_DpsiC
10927  *
10928  */
10929  __pyx_t_31 = __pyx_v_matID;
10930  __pyx_t_17 = -1;
10931  if (__pyx_t_31 < 0) {
10932  __pyx_t_31 += __pyx_pybuffernd_thetaSR.diminfo[0].shape;
10933  if (unlikely(__pyx_t_31 < 0)) __pyx_t_17 = 0;
10934  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_thetaSR.diminfo[0].shape)) __pyx_t_17 = 0;
10935  if (unlikely(__pyx_t_17 != -1)) {
10936  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10937  __PYX_ERR(0, 437, __pyx_L1_error)
10938  }
10939  __pyx_t_32 = __pyx_v_matID;
10940  __pyx_t_17 = -1;
10941  if (__pyx_t_32 < 0) {
10942  __pyx_t_32 += __pyx_pybuffernd_thetaR.diminfo[0].shape;
10943  if (unlikely(__pyx_t_32 < 0)) __pyx_t_17 = 0;
10944  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_thetaR.diminfo[0].shape)) __pyx_t_17 = 0;
10945  if (unlikely(__pyx_t_17 != -1)) {
10946  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10947  __PYX_ERR(0, 437, __pyx_L1_error)
10948  }
10949  __pyx_v_thetaW = (((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_thetaSR.diminfo[0].strides)) * __pyx_v_sBar) + (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_thetaR.diminfo[0].strides)));
10950 
10951  /* "subsurfaceTransportFunctions.pyx":438
10952  *
10953  * thetaW = thetaSR[matID]*sBar + thetaR[matID]
10954  * DthetaW_DpsiC = thetaSR[matID] * DsBar_DpsiC # <<<<<<<<<<<<<<
10955  *
10956  * sqrt_sBar = sqrt(sBar)
10957  */
10958  __pyx_t_33 = __pyx_v_matID;
10959  __pyx_t_17 = -1;
10960  if (__pyx_t_33 < 0) {
10961  __pyx_t_33 += __pyx_pybuffernd_thetaSR.diminfo[0].shape;
10962  if (unlikely(__pyx_t_33 < 0)) __pyx_t_17 = 0;
10963  } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_thetaSR.diminfo[0].shape)) __pyx_t_17 = 0;
10964  if (unlikely(__pyx_t_17 != -1)) {
10965  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10966  __PYX_ERR(0, 438, __pyx_L1_error)
10967  }
10968  __pyx_v_DthetaW_DpsiC = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_thetaSR.diminfo[0].strides)) * __pyx_v_DsBar_DpsiC);
10969 
10970  /* "subsurfaceTransportFunctions.pyx":440
10971  * DthetaW_DpsiC = thetaSR[matID] * DsBar_DpsiC
10972  *
10973  * sqrt_sBar = sqrt(sBar) # <<<<<<<<<<<<<<
10974  * KWr= sqrt_sBar*vBar2
10975  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC)
10976  */
10977  __pyx_v_sqrt_sBar = sqrt(__pyx_v_sBar);
10978 
10979  /* "subsurfaceTransportFunctions.pyx":441
10980  *
10981  * sqrt_sBar = sqrt(sBar)
10982  * KWr= sqrt_sBar*vBar2 # <<<<<<<<<<<<<<
10983  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC)
10984  * else:
10985  */
10986  __pyx_v_KWr = (__pyx_v_sqrt_sBar * __pyx_v_vBar2);
10987 
10988  /* "subsurfaceTransportFunctions.pyx":442
10989  * sqrt_sBar = sqrt(sBar)
10990  * KWr= sqrt_sBar*vBar2
10991  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC) # <<<<<<<<<<<<<<
10992  * else:
10993  * thetaW = thetaS
10994  */
10995  if (unlikely(__pyx_v_sqrt_sBar == 0)) {
10996  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
10997  __PYX_ERR(0, 442, __pyx_L1_error)
10998  }
10999  __pyx_v_DKWr_DpsiC = ((((0.5 / __pyx_v_sqrt_sBar) * __pyx_v_DsBar_DpsiC) * __pyx_v_vBar2) + (((2.0 * __pyx_v_sqrt_sBar) * __pyx_v_vBar) * __pyx_v_DvBar_DpsiC));
11000 
11001  /* "subsurfaceTransportFunctions.pyx":422
11002  * m = 1.0 - 1.0/n[matID]
11003  * thetaS = thetaR[matID] + thetaSR[matID]
11004  * if psiC > 0.0: # <<<<<<<<<<<<<<
11005  * pcBar = alpha[matID]*psiC
11006  * pcBar_nM2 = pow(pcBar,n[matID]-2)
11007  */
11008  goto __pyx_L9;
11009  }
11010 
11011  /* "subsurfaceTransportFunctions.pyx":444
11012  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC)
11013  * else:
11014  * thetaW = thetaS # <<<<<<<<<<<<<<
11015  * DthetaW_DpsiC = 0.0
11016  * KWr = 1.0
11017  */
11018  /*else*/ {
11019  __pyx_v_thetaW = __pyx_v_thetaS;
11020 
11021  /* "subsurfaceTransportFunctions.pyx":445
11022  * else:
11023  * thetaW = thetaS
11024  * DthetaW_DpsiC = 0.0 # <<<<<<<<<<<<<<
11025  * KWr = 1.0
11026  * DKWr_DpsiC = 0.0
11027  */
11028  __pyx_v_DthetaW_DpsiC = 0.0;
11029 
11030  /* "subsurfaceTransportFunctions.pyx":446
11031  * thetaW = thetaS
11032  * DthetaW_DpsiC = 0.0
11033  * KWr = 1.0 # <<<<<<<<<<<<<<
11034  * DKWr_DpsiC = 0.0
11035  * #
11036  */
11037  __pyx_v_KWr = 1.0;
11038 
11039  /* "subsurfaceTransportFunctions.pyx":447
11040  * DthetaW_DpsiC = 0.0
11041  * KWr = 1.0
11042  * DKWr_DpsiC = 0.0 # <<<<<<<<<<<<<<
11043  * #
11044  * rhom = rho*exp(beta*u_j)
11045  */
11046  __pyx_v_DKWr_DpsiC = 0.0;
11047  }
11048  __pyx_L9:;
11049 
11050  /* "subsurfaceTransportFunctions.pyx":449
11051  * DKWr_DpsiC = 0.0
11052  * #
11053  * rhom = rho*exp(beta*u_j) # <<<<<<<<<<<<<<
11054  * drhom= beta*rhom
11055  * q_mass[eN,j] = rhom*thetaW
11056  */
11057  __pyx_v_rhom = (__pyx_v_rho * exp((__pyx_v_beta * __pyx_v_u_j)));
11058 
11059  /* "subsurfaceTransportFunctions.pyx":450
11060  * #
11061  * rhom = rho*exp(beta*u_j)
11062  * drhom= beta*rhom # <<<<<<<<<<<<<<
11063  * q_mass[eN,j] = rhom*thetaW
11064  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW
11065  */
11066  __pyx_v_drhom = (__pyx_v_beta * __pyx_v_rhom);
11067 
11068  /* "subsurfaceTransportFunctions.pyx":451
11069  * rhom = rho*exp(beta*u_j)
11070  * drhom= beta*rhom
11071  * q_mass[eN,j] = rhom*thetaW # <<<<<<<<<<<<<<
11072  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW
11073  *
11074  */
11075  __pyx_t_34 = __pyx_v_eN;
11076  __pyx_t_35 = __pyx_v_j;
11077  __pyx_t_17 = -1;
11078  if (__pyx_t_34 < 0) {
11079  __pyx_t_34 += __pyx_pybuffernd_q_mass.diminfo[0].shape;
11080  if (unlikely(__pyx_t_34 < 0)) __pyx_t_17 = 0;
11081  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_q_mass.diminfo[0].shape)) __pyx_t_17 = 0;
11082  if (__pyx_t_35 < 0) {
11083  __pyx_t_35 += __pyx_pybuffernd_q_mass.diminfo[1].shape;
11084  if (unlikely(__pyx_t_35 < 0)) __pyx_t_17 = 1;
11085  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_q_mass.diminfo[1].shape)) __pyx_t_17 = 1;
11086  if (unlikely(__pyx_t_17 != -1)) {
11087  __Pyx_RaiseBufferIndexError(__pyx_t_17);
11088  __PYX_ERR(0, 451, __pyx_L1_error)
11089  }
11090  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_q_mass.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_q_mass.diminfo[1].strides) = (__pyx_v_rhom * __pyx_v_thetaW);
11091 
11092  /* "subsurfaceTransportFunctions.pyx":452
11093  * drhom= beta*rhom
11094  * q_mass[eN,j] = rhom*thetaW
11095  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW # <<<<<<<<<<<<<<
11096  *
11097  * q_kr[eN,j] = KWr
11098  */
11099  __pyx_t_36 = __pyx_v_eN;
11100  __pyx_t_37 = __pyx_v_j;
11101  __pyx_t_17 = -1;
11102  if (__pyx_t_36 < 0) {
11103  __pyx_t_36 += __pyx_pybuffernd_q_dmass.diminfo[0].shape;
11104  if (unlikely(__pyx_t_36 < 0)) __pyx_t_17 = 0;
11105  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_q_dmass.diminfo[0].shape)) __pyx_t_17 = 0;
11106  if (__pyx_t_37 < 0) {
11107  __pyx_t_37 += __pyx_pybuffernd_q_dmass.diminfo[1].shape;
11108  if (unlikely(__pyx_t_37 < 0)) __pyx_t_17 = 1;
11109  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_q_dmass.diminfo[1].shape)) __pyx_t_17 = 1;
11110  if (unlikely(__pyx_t_17 != -1)) {
11111  __Pyx_RaiseBufferIndexError(__pyx_t_17);
11112  __PYX_ERR(0, 452, __pyx_L1_error)
11113  }
11114  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_q_dmass.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_q_dmass.diminfo[1].strides) = (((-__pyx_v_rhom) * __pyx_v_DthetaW_DpsiC) + (__pyx_v_drhom * __pyx_v_thetaW));
11115 
11116  /* "subsurfaceTransportFunctions.pyx":454
11117  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW
11118  *
11119  * q_kr[eN,j] = KWr # <<<<<<<<<<<<<<
11120  * q_dkr[eN,j]= -DKWr_DpsiC
11121  *
11122  */
11123  __pyx_t_38 = __pyx_v_eN;
11124  __pyx_t_39 = __pyx_v_j;
11125  __pyx_t_17 = -1;
11126  if (__pyx_t_38 < 0) {
11127  __pyx_t_38 += __pyx_pybuffernd_q_kr.diminfo[0].shape;
11128  if (unlikely(__pyx_t_38 < 0)) __pyx_t_17 = 0;
11129  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_q_kr.diminfo[0].shape)) __pyx_t_17 = 0;
11130  if (__pyx_t_39 < 0) {
11131  __pyx_t_39 += __pyx_pybuffernd_q_kr.diminfo[1].shape;
11132  if (unlikely(__pyx_t_39 < 0)) __pyx_t_17 = 1;
11133  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_q_kr.diminfo[1].shape)) __pyx_t_17 = 1;
11134  if (unlikely(__pyx_t_17 != -1)) {
11135  __Pyx_RaiseBufferIndexError(__pyx_t_17);
11136  __PYX_ERR(0, 454, __pyx_L1_error)
11137  }
11138  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_q_kr.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_q_kr.diminfo[1].strides) = __pyx_v_KWr;
11139 
11140  /* "subsurfaceTransportFunctions.pyx":455
11141  *
11142  * q_kr[eN,j] = KWr
11143  * q_dkr[eN,j]= -DKWr_DpsiC # <<<<<<<<<<<<<<
11144  *
11145  * #j
11146  */
11147  __pyx_t_40 = __pyx_v_eN;
11148  __pyx_t_41 = __pyx_v_j;
11149  __pyx_t_17 = -1;
11150  if (__pyx_t_40 < 0) {
11151  __pyx_t_40 += __pyx_pybuffernd_q_dkr.diminfo[0].shape;
11152  if (unlikely(__pyx_t_40 < 0)) __pyx_t_17 = 0;
11153  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_q_dkr.diminfo[0].shape)) __pyx_t_17 = 0;
11154  if (__pyx_t_41 < 0) {
11155  __pyx_t_41 += __pyx_pybuffernd_q_dkr.diminfo[1].shape;
11156  if (unlikely(__pyx_t_41 < 0)) __pyx_t_17 = 1;
11157  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_q_dkr.diminfo[1].shape)) __pyx_t_17 = 1;
11158  if (unlikely(__pyx_t_17 != -1)) {
11159  __Pyx_RaiseBufferIndexError(__pyx_t_17);
11160  __PYX_ERR(0, 455, __pyx_L1_error)
11161  }
11162  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_q_dkr.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_q_dkr.diminfo[1].strides) = (-__pyx_v_DKWr_DpsiC);
11163  }
11164  }
11165 
11166  /* "subsurfaceTransportFunctions.pyx":461
11167  *
11168  * #now upwind kr
11169  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
11170  * u_eN = numpy.sum(q_u[eN])*nAvgWeight
11171  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight
11172  */
11173  __pyx_t_8 = __pyx_v_nElements_global;
11174  __pyx_t_9 = __pyx_t_8;
11175  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
11176  __pyx_v_eN = __pyx_t_10;
11177 
11178  /* "subsurfaceTransportFunctions.pyx":462
11179  * #now upwind kr
11180  * for eN in range(nElements_global):
11181  * u_eN = numpy.sum(q_u[eN])*nAvgWeight # <<<<<<<<<<<<<<
11182  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight
11183  * #potential assumes slight compressibility
11184  */
11185  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 462, __pyx_L1_error)
11186  __Pyx_GOTREF(__pyx_t_5);
11187  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L1_error)
11188  __Pyx_GOTREF(__pyx_t_1);
11189  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11190  __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_u), __pyx_v_eN, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 462, __pyx_L1_error)
11191  __Pyx_GOTREF(__pyx_t_5);
11192  __pyx_t_4 = NULL;
11193  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
11194  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
11195  if (likely(__pyx_t_4)) {
11196  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
11197  __Pyx_INCREF(__pyx_t_4);
11198  __Pyx_INCREF(function);
11199  __Pyx_DECREF_SET(__pyx_t_1, function);
11200  }
11201  }
11202  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5);
11203  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
11204  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11205  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L1_error)
11206  __Pyx_GOTREF(__pyx_t_2);
11207  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11208  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L1_error)
11209  __Pyx_GOTREF(__pyx_t_1);
11210  __pyx_t_5 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 462, __pyx_L1_error)
11211  __Pyx_GOTREF(__pyx_t_5);
11212  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11213  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11214  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 462, __pyx_L1_error)
11215  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11216  __pyx_v_u_eN = __pyx_t_7;
11217 
11218  /* "subsurfaceTransportFunctions.pyx":463
11219  * for eN in range(nElements_global):
11220  * u_eN = numpy.sum(q_u[eN])*nAvgWeight
11221  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight # <<<<<<<<<<<<<<
11222  * #potential assumes slight compressibility
11223  * phi_eN= u_eN - numpy.dot(gravity,elementBarycentersArray[eN])
11224  */
11225  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
11226  __Pyx_GOTREF(__pyx_t_1);
11227  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 463, __pyx_L1_error)
11228  __Pyx_GOTREF(__pyx_t_2);
11229  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11230  __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_kr), __pyx_v_eN, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
11231  __Pyx_GOTREF(__pyx_t_1);
11232  __pyx_t_4 = NULL;
11233  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
11234  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
11235  if (likely(__pyx_t_4)) {
11236  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
11237  __Pyx_INCREF(__pyx_t_4);
11238  __Pyx_INCREF(function);
11239  __Pyx_DECREF_SET(__pyx_t_2, function);
11240  }
11241  }
11242  __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1);
11243  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
11244  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11245  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 463, __pyx_L1_error)
11246  __Pyx_GOTREF(__pyx_t_5);
11247  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11248  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 463, __pyx_L1_error)
11249  __Pyx_GOTREF(__pyx_t_2);
11250  __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
11251  __Pyx_GOTREF(__pyx_t_1);
11252  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11253  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11254  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 463, __pyx_L1_error)
11255  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11256  __pyx_v_kr_eN = __pyx_t_7;
11257 
11258  /* "subsurfaceTransportFunctions.pyx":465
11259  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight
11260  * #potential assumes slight compressibility
11261  * phi_eN= u_eN - numpy.dot(gravity,elementBarycentersArray[eN]) # <<<<<<<<<<<<<<
11262  *
11263  *
11264  */
11265  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_u_eN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 465, __pyx_L1_error)
11266  __Pyx_GOTREF(__pyx_t_1);
11267  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 465, __pyx_L1_error)
11268  __Pyx_GOTREF(__pyx_t_5);
11269  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_dot); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 465, __pyx_L1_error)
11270  __Pyx_GOTREF(__pyx_t_4);
11271  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11272  __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_v_eN, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 465, __pyx_L1_error)
11273  __Pyx_GOTREF(__pyx_t_5);
11274  __pyx_t_42 = NULL;
11275  __pyx_t_12 = 0;
11276  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
11277  __pyx_t_42 = PyMethod_GET_SELF(__pyx_t_4);
11278  if (likely(__pyx_t_42)) {
11279  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
11280  __Pyx_INCREF(__pyx_t_42);
11281  __Pyx_INCREF(function);
11282  __Pyx_DECREF_SET(__pyx_t_4, function);
11283  __pyx_t_12 = 1;
11284  }
11285  }
11286  #if CYTHON_FAST_PYCALL
11287  if (PyFunction_Check(__pyx_t_4)) {
11288  PyObject *__pyx_temp[3] = {__pyx_t_42, ((PyObject *)__pyx_v_gravity), __pyx_t_5};
11289  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error)
11290  __Pyx_XDECREF(__pyx_t_42); __pyx_t_42 = 0;
11291  __Pyx_GOTREF(__pyx_t_2);
11292  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11293  } else
11294  #endif
11295  #if CYTHON_FAST_PYCCALL
11296  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
11297  PyObject *__pyx_temp[3] = {__pyx_t_42, ((PyObject *)__pyx_v_gravity), __pyx_t_5};
11298  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error)
11299  __Pyx_XDECREF(__pyx_t_42); __pyx_t_42 = 0;
11300  __Pyx_GOTREF(__pyx_t_2);
11301  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11302  } else
11303  #endif
11304  {
11305  __pyx_t_43 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 465, __pyx_L1_error)
11306  __Pyx_GOTREF(__pyx_t_43);
11307  if (__pyx_t_42) {
11308  __Pyx_GIVEREF(__pyx_t_42); PyTuple_SET_ITEM(__pyx_t_43, 0, __pyx_t_42); __pyx_t_42 = NULL;
11309  }
11310  __Pyx_INCREF(((PyObject *)__pyx_v_gravity));
11311  __Pyx_GIVEREF(((PyObject *)__pyx_v_gravity));
11312  PyTuple_SET_ITEM(__pyx_t_43, 0+__pyx_t_12, ((PyObject *)__pyx_v_gravity));
11313  __Pyx_GIVEREF(__pyx_t_5);
11314  PyTuple_SET_ITEM(__pyx_t_43, 1+__pyx_t_12, __pyx_t_5);
11315  __pyx_t_5 = 0;
11316  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_43, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error)
11317  __Pyx_GOTREF(__pyx_t_2);
11318  __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
11319  }
11320  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11321  __pyx_t_4 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 465, __pyx_L1_error)
11322  __Pyx_GOTREF(__pyx_t_4);
11323  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11324  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11325  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 465, __pyx_L1_error)
11326  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11327  __pyx_v_phi_eN = __pyx_t_7;
11328 
11329  /* "subsurfaceTransportFunctions.pyx":469
11330  *
11331  * #loop over faces to upwind
11332  * for ebN in range(nElementBoundaries_element): # <<<<<<<<<<<<<<
11333  * #by default eN is upwind
11334  * q_kr_up[eN,ebN] = kr_eN
11335  */
11336  __pyx_t_12 = __pyx_v_nElementBoundaries_element;
11337  __pyx_t_13 = __pyx_t_12;
11338  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
11339  __pyx_v_ebN = __pyx_t_14;
11340 
11341  /* "subsurfaceTransportFunctions.pyx":471
11342  * for ebN in range(nElementBoundaries_element):
11343  * #by default eN is upwind
11344  * q_kr_up[eN,ebN] = kr_eN # <<<<<<<<<<<<<<
11345  * eN_neighbor = elementNeighborsArray[eN,ebN]
11346  * if eN_neighbor >= 0:
11347  */
11348  __pyx_t_44 = __pyx_v_eN;
11349  __pyx_t_45 = __pyx_v_ebN;
11350  __pyx_t_17 = -1;
11351  if (__pyx_t_44 < 0) {
11352  __pyx_t_44 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
11353  if (unlikely(__pyx_t_44 < 0)) __pyx_t_17 = 0;
11354  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_17 = 0;
11355  if (__pyx_t_45 < 0) {
11356  __pyx_t_45 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
11357  if (unlikely(__pyx_t_45 < 0)) __pyx_t_17 = 1;
11358  } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_17 = 1;
11359  if (unlikely(__pyx_t_17 != -1)) {
11360  __Pyx_RaiseBufferIndexError(__pyx_t_17);
11361  __PYX_ERR(0, 471, __pyx_L1_error)
11362  }
11363  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_q_kr_up.diminfo[1].strides) = __pyx_v_kr_eN;
11364 
11365  /* "subsurfaceTransportFunctions.pyx":472
11366  * #by default eN is upwind
11367  * q_kr_up[eN,ebN] = kr_eN
11368  * eN_neighbor = elementNeighborsArray[eN,ebN] # <<<<<<<<<<<<<<
11369  * if eN_neighbor >= 0:
11370  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
11371  */
11372  __pyx_t_46 = __pyx_v_eN;
11373  __pyx_t_47 = __pyx_v_ebN;
11374  __pyx_t_17 = -1;
11375  if (__pyx_t_46 < 0) {
11376  __pyx_t_46 += __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape;
11377  if (unlikely(__pyx_t_46 < 0)) __pyx_t_17 = 0;
11378  } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape)) __pyx_t_17 = 0;
11379  if (__pyx_t_47 < 0) {
11380  __pyx_t_47 += __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape;
11381  if (unlikely(__pyx_t_47 < 0)) __pyx_t_17 = 1;
11382  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape)) __pyx_t_17 = 1;
11383  if (unlikely(__pyx_t_17 != -1)) {
11384  __Pyx_RaiseBufferIndexError(__pyx_t_17);
11385  __PYX_ERR(0, 472, __pyx_L1_error)
11386  }
11387  __pyx_v_eN_neighbor = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides));
11388 
11389  /* "subsurfaceTransportFunctions.pyx":473
11390  * q_kr_up[eN,ebN] = kr_eN
11391  * eN_neighbor = elementNeighborsArray[eN,ebN]
11392  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
11393  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
11394  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
11395  */
11396  __pyx_t_6 = ((__pyx_v_eN_neighbor >= 0) != 0);
11397  if (__pyx_t_6) {
11398 
11399  /* "subsurfaceTransportFunctions.pyx":474
11400  * eN_neighbor = elementNeighborsArray[eN,ebN]
11401  * if eN_neighbor >= 0:
11402  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight # <<<<<<<<<<<<<<
11403  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
11404  * #potential, assumes slight compressibility
11405  */
11406  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 474, __pyx_L1_error)
11407  __Pyx_GOTREF(__pyx_t_2);
11408  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error)
11409  __Pyx_GOTREF(__pyx_t_1);
11410  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11411  __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_u), __pyx_v_eN_neighbor, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 474, __pyx_L1_error)
11412  __Pyx_GOTREF(__pyx_t_2);
11413  __pyx_t_43 = NULL;
11414  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
11415  __pyx_t_43 = PyMethod_GET_SELF(__pyx_t_1);
11416  if (likely(__pyx_t_43)) {
11417  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
11418  __Pyx_INCREF(__pyx_t_43);
11419  __Pyx_INCREF(function);
11420  __Pyx_DECREF_SET(__pyx_t_1, function);
11421  }
11422  }
11423  __pyx_t_4 = (__pyx_t_43) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_43, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2);
11424  __Pyx_XDECREF(__pyx_t_43); __pyx_t_43 = 0;
11425  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11426  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 474, __pyx_L1_error)
11427  __Pyx_GOTREF(__pyx_t_4);
11428  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11429  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error)
11430  __Pyx_GOTREF(__pyx_t_1);
11431  __pyx_t_2 = PyNumber_Multiply(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 474, __pyx_L1_error)
11432  __Pyx_GOTREF(__pyx_t_2);
11433  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11434  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11435  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 474, __pyx_L1_error)
11436  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11437  __pyx_v_u_neig = __pyx_t_7;
11438 
11439  /* "subsurfaceTransportFunctions.pyx":475
11440  * if eN_neighbor >= 0:
11441  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
11442  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight # <<<<<<<<<<<<<<
11443  * #potential, assumes slight compressibility
11444  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor])
11445  */
11446  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 475, __pyx_L1_error)
11447  __Pyx_GOTREF(__pyx_t_1);
11448  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 475, __pyx_L1_error)
11449  __Pyx_GOTREF(__pyx_t_4);
11450  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11451  __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_kr), __pyx_v_eN_neighbor, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 475, __pyx_L1_error)
11452  __Pyx_GOTREF(__pyx_t_1);
11453  __pyx_t_43 = NULL;
11454  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
11455  __pyx_t_43 = PyMethod_GET_SELF(__pyx_t_4);
11456  if (likely(__pyx_t_43)) {
11457  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
11458  __Pyx_INCREF(__pyx_t_43);
11459  __Pyx_INCREF(function);
11460  __Pyx_DECREF_SET(__pyx_t_4, function);
11461  }
11462  }
11463  __pyx_t_2 = (__pyx_t_43) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_43, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1);
11464  __Pyx_XDECREF(__pyx_t_43); __pyx_t_43 = 0;
11465  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11466  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 475, __pyx_L1_error)
11467  __Pyx_GOTREF(__pyx_t_2);
11468  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11469  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 475, __pyx_L1_error)
11470  __Pyx_GOTREF(__pyx_t_4);
11471  __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 475, __pyx_L1_error)
11472  __Pyx_GOTREF(__pyx_t_1);
11473  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11474  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11475  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 475, __pyx_L1_error)
11476  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11477  __pyx_v_kr_neig = __pyx_t_7;
11478 
11479  /* "subsurfaceTransportFunctions.pyx":477
11480  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
11481  * #potential, assumes slight compressibility
11482  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor]) # <<<<<<<<<<<<<<
11483  *
11484  * if phi_eN < phi_neig: #neighbor is upwind
11485  */
11486  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_u_neig); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 477, __pyx_L1_error)
11487  __Pyx_GOTREF(__pyx_t_1);
11488  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L1_error)
11489  __Pyx_GOTREF(__pyx_t_2);
11490  __pyx_t_43 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dot); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 477, __pyx_L1_error)
11491  __Pyx_GOTREF(__pyx_t_43);
11492  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11493  __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_v_eN_neighbor, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L1_error)
11494  __Pyx_GOTREF(__pyx_t_2);
11495  __pyx_t_5 = NULL;
11496  __pyx_t_17 = 0;
11497  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_43))) {
11498  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_43);
11499  if (likely(__pyx_t_5)) {
11500  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_43);
11501  __Pyx_INCREF(__pyx_t_5);
11502  __Pyx_INCREF(function);
11503  __Pyx_DECREF_SET(__pyx_t_43, function);
11504  __pyx_t_17 = 1;
11505  }
11506  }
11507  #if CYTHON_FAST_PYCALL
11508  if (PyFunction_Check(__pyx_t_43)) {
11509  PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_gravity), __pyx_t_2};
11510  __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_43, __pyx_temp+1-__pyx_t_17, 2+__pyx_t_17); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L1_error)
11511  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11512  __Pyx_GOTREF(__pyx_t_4);
11513  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11514  } else
11515  #endif
11516  #if CYTHON_FAST_PYCCALL
11517  if (__Pyx_PyFastCFunction_Check(__pyx_t_43)) {
11518  PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_gravity), __pyx_t_2};
11519  __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_43, __pyx_temp+1-__pyx_t_17, 2+__pyx_t_17); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L1_error)
11520  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11521  __Pyx_GOTREF(__pyx_t_4);
11522  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11523  } else
11524  #endif
11525  {
11526  __pyx_t_42 = PyTuple_New(2+__pyx_t_17); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 477, __pyx_L1_error)
11527  __Pyx_GOTREF(__pyx_t_42);
11528  if (__pyx_t_5) {
11529  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_42, 0, __pyx_t_5); __pyx_t_5 = NULL;
11530  }
11531  __Pyx_INCREF(((PyObject *)__pyx_v_gravity));
11532  __Pyx_GIVEREF(((PyObject *)__pyx_v_gravity));
11533  PyTuple_SET_ITEM(__pyx_t_42, 0+__pyx_t_17, ((PyObject *)__pyx_v_gravity));
11534  __Pyx_GIVEREF(__pyx_t_2);
11535  PyTuple_SET_ITEM(__pyx_t_42, 1+__pyx_t_17, __pyx_t_2);
11536  __pyx_t_2 = 0;
11537  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_43, __pyx_t_42, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L1_error)
11538  __Pyx_GOTREF(__pyx_t_4);
11539  __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0;
11540  }
11541  __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
11542  __pyx_t_43 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 477, __pyx_L1_error)
11543  __Pyx_GOTREF(__pyx_t_43);
11544  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11545  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11546  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_43); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 477, __pyx_L1_error)
11547  __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
11548  __pyx_v_phi_neig = __pyx_t_7;
11549 
11550  /* "subsurfaceTransportFunctions.pyx":479
11551  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor])
11552  *
11553  * if phi_eN < phi_neig: #neighbor is upwind # <<<<<<<<<<<<<<
11554  * q_kr_up[eN,ebN] = kr_neig
11555  *
11556  */
11557  __pyx_t_6 = ((__pyx_v_phi_eN < __pyx_v_phi_neig) != 0);
11558  if (__pyx_t_6) {
11559 
11560  /* "subsurfaceTransportFunctions.pyx":480
11561  *
11562  * if phi_eN < phi_neig: #neighbor is upwind
11563  * q_kr_up[eN,ebN] = kr_neig # <<<<<<<<<<<<<<
11564  *
11565  * #neighbor
11566  */
11567  __pyx_t_48 = __pyx_v_eN;
11568  __pyx_t_49 = __pyx_v_ebN;
11569  __pyx_t_17 = -1;
11570  if (__pyx_t_48 < 0) {
11571  __pyx_t_48 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
11572  if (unlikely(__pyx_t_48 < 0)) __pyx_t_17 = 0;
11573  } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_17 = 0;
11574  if (__pyx_t_49 < 0) {
11575  __pyx_t_49 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
11576  if (unlikely(__pyx_t_49 < 0)) __pyx_t_17 = 1;
11577  } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_17 = 1;
11578  if (unlikely(__pyx_t_17 != -1)) {
11579  __Pyx_RaiseBufferIndexError(__pyx_t_17);
11580  __PYX_ERR(0, 480, __pyx_L1_error)
11581  }
11582  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_q_kr_up.diminfo[1].strides) = __pyx_v_kr_neig;
11583 
11584  /* "subsurfaceTransportFunctions.pyx":479
11585  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor])
11586  *
11587  * if phi_eN < phi_neig: #neighbor is upwind # <<<<<<<<<<<<<<
11588  * q_kr_up[eN,ebN] = kr_neig
11589  *
11590  */
11591  }
11592 
11593  /* "subsurfaceTransportFunctions.pyx":473
11594  * q_kr_up[eN,ebN] = kr_eN
11595  * eN_neighbor = elementNeighborsArray[eN,ebN]
11596  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
11597  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
11598  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
11599  */
11600  }
11601  }
11602  }
11603 
11604  /* "subsurfaceTransportFunctions.pyx":359
11605  *
11606  *
11607  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
11608  * double beta,
11609  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
11610  */
11611 
11612  /* function exit code */
11613  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11614  goto __pyx_L0;
11615  __pyx_L1_error:;
11616  __Pyx_XDECREF(__pyx_t_1);
11617  __Pyx_XDECREF(__pyx_t_2);
11618  __Pyx_XDECREF(__pyx_t_4);
11619  __Pyx_XDECREF(__pyx_t_5);
11620  __Pyx_XDECREF(__pyx_t_42);
11621  __Pyx_XDECREF(__pyx_t_43);
11622  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
11623  __Pyx_PyThreadState_declare
11624  __Pyx_PyThreadState_assign
11625  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
11626  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer);
11627  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
11628  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
11629  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
11630  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
11631  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
11632  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
11633  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmass.rcbuffer->pybuffer);
11634  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
11635  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
11636  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mass.rcbuffer->pybuffer);
11637  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
11638  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
11639  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_x.rcbuffer->pybuffer);
11640  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaR.rcbuffer->pybuffer);
11641  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaSR.rcbuffer->pybuffer);
11642  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_dof.rcbuffer->pybuffer);
11643  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_l2g.rcbuffer->pybuffer);
11644  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
11645  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_VGM", __pyx_clineno, __pyx_lineno, __pyx_filename);
11646  __pyx_r = NULL;
11647  goto __pyx_L2;
11648  __pyx_L0:;
11649  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer);
11650  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
11651  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
11652  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
11653  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
11654  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
11655  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
11656  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmass.rcbuffer->pybuffer);
11657  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
11658  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
11659  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mass.rcbuffer->pybuffer);
11660  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
11661  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
11662  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_x.rcbuffer->pybuffer);
11663  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaR.rcbuffer->pybuffer);
11664  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaSR.rcbuffer->pybuffer);
11665  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_dof.rcbuffer->pybuffer);
11666  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_l2g.rcbuffer->pybuffer);
11667  __pyx_L2:;
11668  __Pyx_XDECREF(__pyx_v_q);
11669  __Pyx_XGIVEREF(__pyx_r);
11670  __Pyx_RefNannyFinishContext();
11671  return __pyx_r;
11672 }
11673 
11674 /* "subsurfaceTransportFunctions.pyx":486
11675  * #eN for upwind
11676  *
11677  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
11678  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
11679  * numpy.ndarray[ITYPE_t,ndim=1] colind,
11680  */
11681 
11682 /* Python wrapper */
11683 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11684 static char __pyx_doc_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual[] = "\n residual routine for NCP1 approximation for conservative head formulation of Richards equation \n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n upwinds relative permeability based on element averages\n applies dirichlet boundary conditions strongly but keeps dofs in system\n\n TODO:\n everything\n \n ";
11685 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual = {"RE_NCP1_getElementResidual", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual};
11686 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11687  CYTHON_UNUSED PyArrayObject *__pyx_v_gravity = 0;
11688  PyArrayObject *__pyx_v_rowptr = 0;
11689  PyArrayObject *__pyx_v_colind = 0;
11690  int __pyx_v_nSpace;
11691  int __pyx_v_nElements_global;
11692  int __pyx_v_nElementBoundaries_element;
11693  CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray = 0;
11694  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray = 0;
11695  int __pyx_v_nDOF_test_element;
11696  PyArrayObject *__pyx_v_q_u = 0;
11697  PyArrayObject *__pyx_v_q_grad_u = 0;
11698  PyArrayObject *__pyx_v_q_grad_w = 0;
11699  PyArrayObject *__pyx_v_q_detJ = 0;
11700  PyArrayObject *__pyx_v_q_m = 0;
11701  PyArrayObject *__pyx_v_q_mt = 0;
11702  PyArrayObject *__pyx_v_q_r = 0;
11703  PyArrayObject *__pyx_v_q_kr = 0;
11704  PyArrayObject *__pyx_v_q_kr_up = 0;
11705  PyArrayObject *__pyx_v_q_flin = 0;
11706  PyArrayObject *__pyx_v_q_alin = 0;
11707  PyArrayObject *__pyx_v_elementResidual = 0;
11708  PyObject *__pyx_r = 0;
11709  __Pyx_RefNannyDeclarations
11710  __Pyx_RefNannySetupContext("RE_NCP1_getElementResidual (wrapper)", 0);
11711  {
11712  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gravity,&__pyx_n_s_rowptr,&__pyx_n_s_colind,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_nDOF_test_element,&__pyx_n_s_q_u,&__pyx_n_s_q_grad_u,&__pyx_n_s_q_grad_w,&__pyx_n_s_q_detJ,&__pyx_n_s_q_m,&__pyx_n_s_q_mt,&__pyx_n_s_q_r,&__pyx_n_s_q_kr,&__pyx_n_s_q_kr_up,&__pyx_n_s_q_flin,&__pyx_n_s_q_alin,&__pyx_n_s_elementResidual,0};
11713  PyObject* values[21] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
11714  if (unlikely(__pyx_kwds)) {
11715  Py_ssize_t kw_args;
11716  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11717  switch (pos_args) {
11718  case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
11719  CYTHON_FALLTHROUGH;
11720  case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
11721  CYTHON_FALLTHROUGH;
11722  case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
11723  CYTHON_FALLTHROUGH;
11724  case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
11725  CYTHON_FALLTHROUGH;
11726  case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
11727  CYTHON_FALLTHROUGH;
11728  case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
11729  CYTHON_FALLTHROUGH;
11730  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
11731  CYTHON_FALLTHROUGH;
11732  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
11733  CYTHON_FALLTHROUGH;
11734  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
11735  CYTHON_FALLTHROUGH;
11736  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
11737  CYTHON_FALLTHROUGH;
11738  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
11739  CYTHON_FALLTHROUGH;
11740  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
11741  CYTHON_FALLTHROUGH;
11742  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
11743  CYTHON_FALLTHROUGH;
11744  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
11745  CYTHON_FALLTHROUGH;
11746  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
11747  CYTHON_FALLTHROUGH;
11748  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
11749  CYTHON_FALLTHROUGH;
11750  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11751  CYTHON_FALLTHROUGH;
11752  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11753  CYTHON_FALLTHROUGH;
11754  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11755  CYTHON_FALLTHROUGH;
11756  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11757  CYTHON_FALLTHROUGH;
11758  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11759  CYTHON_FALLTHROUGH;
11760  case 0: break;
11761  default: goto __pyx_L5_argtuple_error;
11762  }
11763  kw_args = PyDict_Size(__pyx_kwds);
11764  switch (pos_args) {
11765  case 0:
11766  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
11767  else goto __pyx_L5_argtuple_error;
11768  CYTHON_FALLTHROUGH;
11769  case 1:
11770  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
11771  else {
11772  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 1); __PYX_ERR(0, 486, __pyx_L3_error)
11773  }
11774  CYTHON_FALLTHROUGH;
11775  case 2:
11776  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
11777  else {
11778  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 2); __PYX_ERR(0, 486, __pyx_L3_error)
11779  }
11780  CYTHON_FALLTHROUGH;
11781  case 3:
11782  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
11783  else {
11784  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 3); __PYX_ERR(0, 486, __pyx_L3_error)
11785  }
11786  CYTHON_FALLTHROUGH;
11787  case 4:
11788  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
11789  else {
11790  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 4); __PYX_ERR(0, 486, __pyx_L3_error)
11791  }
11792  CYTHON_FALLTHROUGH;
11793  case 5:
11794  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
11795  else {
11796  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 5); __PYX_ERR(0, 486, __pyx_L3_error)
11797  }
11798  CYTHON_FALLTHROUGH;
11799  case 6:
11800  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
11801  else {
11802  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 6); __PYX_ERR(0, 486, __pyx_L3_error)
11803  }
11804  CYTHON_FALLTHROUGH;
11805  case 7:
11806  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
11807  else {
11808  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 7); __PYX_ERR(0, 486, __pyx_L3_error)
11809  }
11810  CYTHON_FALLTHROUGH;
11811  case 8:
11812  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nDOF_test_element)) != 0)) kw_args--;
11813  else {
11814  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 8); __PYX_ERR(0, 486, __pyx_L3_error)
11815  }
11816  CYTHON_FALLTHROUGH;
11817  case 9:
11818  if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_u)) != 0)) kw_args--;
11819  else {
11820  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 9); __PYX_ERR(0, 486, __pyx_L3_error)
11821  }
11822  CYTHON_FALLTHROUGH;
11823  case 10:
11824  if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_grad_u)) != 0)) kw_args--;
11825  else {
11826  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 10); __PYX_ERR(0, 486, __pyx_L3_error)
11827  }
11828  CYTHON_FALLTHROUGH;
11829  case 11:
11830  if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_grad_w)) != 0)) kw_args--;
11831  else {
11832  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 11); __PYX_ERR(0, 486, __pyx_L3_error)
11833  }
11834  CYTHON_FALLTHROUGH;
11835  case 12:
11836  if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_detJ)) != 0)) kw_args--;
11837  else {
11838  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 12); __PYX_ERR(0, 486, __pyx_L3_error)
11839  }
11840  CYTHON_FALLTHROUGH;
11841  case 13:
11842  if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_m)) != 0)) kw_args--;
11843  else {
11844  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 13); __PYX_ERR(0, 486, __pyx_L3_error)
11845  }
11846  CYTHON_FALLTHROUGH;
11847  case 14:
11848  if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_mt)) != 0)) kw_args--;
11849  else {
11850  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 14); __PYX_ERR(0, 486, __pyx_L3_error)
11851  }
11852  CYTHON_FALLTHROUGH;
11853  case 15:
11854  if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_r)) != 0)) kw_args--;
11855  else {
11856  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 15); __PYX_ERR(0, 486, __pyx_L3_error)
11857  }
11858  CYTHON_FALLTHROUGH;
11859  case 16:
11860  if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr)) != 0)) kw_args--;
11861  else {
11862  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 16); __PYX_ERR(0, 486, __pyx_L3_error)
11863  }
11864  CYTHON_FALLTHROUGH;
11865  case 17:
11866  if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr_up)) != 0)) kw_args--;
11867  else {
11868  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 17); __PYX_ERR(0, 486, __pyx_L3_error)
11869  }
11870  CYTHON_FALLTHROUGH;
11871  case 18:
11872  if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_flin)) != 0)) kw_args--;
11873  else {
11874  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 18); __PYX_ERR(0, 486, __pyx_L3_error)
11875  }
11876  CYTHON_FALLTHROUGH;
11877  case 19:
11878  if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_alin)) != 0)) kw_args--;
11879  else {
11880  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 19); __PYX_ERR(0, 486, __pyx_L3_error)
11881  }
11882  CYTHON_FALLTHROUGH;
11883  case 20:
11884  if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementResidual)) != 0)) kw_args--;
11885  else {
11886  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 20); __PYX_ERR(0, 486, __pyx_L3_error)
11887  }
11888  }
11889  if (unlikely(kw_args > 0)) {
11890  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_getElementResidual") < 0)) __PYX_ERR(0, 486, __pyx_L3_error)
11891  }
11892  } else if (PyTuple_GET_SIZE(__pyx_args) != 21) {
11893  goto __pyx_L5_argtuple_error;
11894  } else {
11895  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11896  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11897  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11898  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11899  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11900  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
11901  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
11902  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
11903  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
11904  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
11905  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
11906  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
11907  values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
11908  values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
11909  values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
11910  values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
11911  values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
11912  values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
11913  values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
11914  values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
11915  values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
11916  }
11917  __pyx_v_gravity = ((PyArrayObject *)values[0]);
11918  __pyx_v_rowptr = ((PyArrayObject *)values[1]);
11919  __pyx_v_colind = ((PyArrayObject *)values[2]);
11920  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 490, __pyx_L3_error)
11921  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 491, __pyx_L3_error)
11922  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 492, __pyx_L3_error)
11923  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[6]);
11924  __pyx_v_elementBarycentersArray = ((PyArrayObject *)values[7]);
11925  __pyx_v_nDOF_test_element = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_nDOF_test_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 496, __pyx_L3_error)
11926  __pyx_v_q_u = ((PyArrayObject *)values[9]);
11927  __pyx_v_q_grad_u = ((PyArrayObject *)values[10]);
11928  __pyx_v_q_grad_w = ((PyArrayObject *)values[11]);
11929  __pyx_v_q_detJ = ((PyArrayObject *)values[12]);
11930  __pyx_v_q_m = ((PyArrayObject *)values[13]);
11931  __pyx_v_q_mt = ((PyArrayObject *)values[14]);
11932  __pyx_v_q_r = ((PyArrayObject *)values[15]);
11933  __pyx_v_q_kr = ((PyArrayObject *)values[16]);
11934  __pyx_v_q_kr_up = ((PyArrayObject *)values[17]);
11935  __pyx_v_q_flin = ((PyArrayObject *)values[18]);
11936  __pyx_v_q_alin = ((PyArrayObject *)values[19]);
11937  __pyx_v_elementResidual = ((PyArrayObject *)values[20]);
11938  }
11939  goto __pyx_L4_argument_unpacking_done;
11940  __pyx_L5_argtuple_error:;
11941  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 486, __pyx_L3_error)
11942  __pyx_L3_error:;
11943  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementResidual", __pyx_clineno, __pyx_lineno, __pyx_filename);
11944  __Pyx_RefNannyFinishContext();
11945  return NULL;
11946  __pyx_L4_argument_unpacking_done:;
11947  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) __PYX_ERR(0, 486, __pyx_L1_error)
11948  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rowptr), __pyx_ptype_5numpy_ndarray, 1, "rowptr", 0))) __PYX_ERR(0, 487, __pyx_L1_error)
11949  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_colind), __pyx_ptype_5numpy_ndarray, 1, "colind", 0))) __PYX_ERR(0, 488, __pyx_L1_error)
11950  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) __PYX_ERR(0, 493, __pyx_L1_error)
11951  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_ptype_5numpy_ndarray, 1, "elementBarycentersArray", 0))) __PYX_ERR(0, 494, __pyx_L1_error)
11952  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_u), __pyx_ptype_5numpy_ndarray, 1, "q_u", 0))) __PYX_ERR(0, 497, __pyx_L1_error)
11953  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_u), __pyx_ptype_5numpy_ndarray, 1, "q_grad_u", 0))) __PYX_ERR(0, 498, __pyx_L1_error)
11954  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_w), __pyx_ptype_5numpy_ndarray, 1, "q_grad_w", 0))) __PYX_ERR(0, 499, __pyx_L1_error)
11955  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_detJ), __pyx_ptype_5numpy_ndarray, 1, "q_detJ", 0))) __PYX_ERR(0, 501, __pyx_L1_error)
11956  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_m), __pyx_ptype_5numpy_ndarray, 1, "q_m", 0))) __PYX_ERR(0, 502, __pyx_L1_error)
11957  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_mt), __pyx_ptype_5numpy_ndarray, 1, "q_mt", 0))) __PYX_ERR(0, 503, __pyx_L1_error)
11958  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_r), __pyx_ptype_5numpy_ndarray, 1, "q_r", 0))) __PYX_ERR(0, 504, __pyx_L1_error)
11959  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr), __pyx_ptype_5numpy_ndarray, 1, "q_kr", 0))) __PYX_ERR(0, 505, __pyx_L1_error)
11960  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr_up), __pyx_ptype_5numpy_ndarray, 1, "q_kr_up", 0))) __PYX_ERR(0, 506, __pyx_L1_error)
11961  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_flin), __pyx_ptype_5numpy_ndarray, 1, "q_flin", 0))) __PYX_ERR(0, 509, __pyx_L1_error)
11962  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_alin), __pyx_ptype_5numpy_ndarray, 1, "q_alin", 0))) __PYX_ERR(0, 510, __pyx_L1_error)
11963  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementResidual), __pyx_ptype_5numpy_ndarray, 1, "elementResidual", 0))) __PYX_ERR(0, 512, __pyx_L1_error)
11964  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual(__pyx_self, __pyx_v_gravity, __pyx_v_rowptr, __pyx_v_colind, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementBarycentersArray, __pyx_v_nDOF_test_element, __pyx_v_q_u, __pyx_v_q_grad_u, __pyx_v_q_grad_w, __pyx_v_q_detJ, __pyx_v_q_m, __pyx_v_q_mt, __pyx_v_q_r, __pyx_v_q_kr, __pyx_v_q_kr_up, __pyx_v_q_flin, __pyx_v_q_alin, __pyx_v_elementResidual);
11965 
11966  /* function exit code */
11967  goto __pyx_L0;
11968  __pyx_L1_error:;
11969  __pyx_r = NULL;
11970  __pyx_L0:;
11971  __Pyx_RefNannyFinishContext();
11972  return __pyx_r;
11973 }
11974 
11975 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementResidual) {
11976  CYTHON_UNUSED int __pyx_v_upwindFlag;
11977  PyObject *__pyx_v_q = NULL;
11978  int __pyx_v_nnz;
11979  int __pyx_v_eN;
11980  int __pyx_v_ii;
11981  int __pyx_v_I;
11982  int __pyx_v_i;
11983  int __pyx_v_ebN;
11984  PyArrayObject *__pyx_v_a_up = 0;
11985  PyArrayObject *__pyx_v_f_up = 0;
11986  double __pyx_v_nAvgWeight;
11987  double __pyx_v_weight;
11988  double __pyx_v_volFactor;
11989  double __pyx_v_volume;
11990  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_up;
11991  __Pyx_Buffer __pyx_pybuffer_a_up;
11992  __Pyx_LocalBuf_ND __pyx_pybuffernd_colind;
11993  __Pyx_Buffer __pyx_pybuffer_colind;
11994  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBarycentersArray;
11995  __Pyx_Buffer __pyx_pybuffer_elementBarycentersArray;
11996  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
11997  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
11998  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementResidual;
11999  __Pyx_Buffer __pyx_pybuffer_elementResidual;
12000  __Pyx_LocalBuf_ND __pyx_pybuffernd_f_up;
12001  __Pyx_Buffer __pyx_pybuffer_f_up;
12002  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
12003  __Pyx_Buffer __pyx_pybuffer_gravity;
12004  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_alin;
12005  __Pyx_Buffer __pyx_pybuffer_q_alin;
12006  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_detJ;
12007  __Pyx_Buffer __pyx_pybuffer_q_detJ;
12008  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_flin;
12009  __Pyx_Buffer __pyx_pybuffer_q_flin;
12010  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_u;
12011  __Pyx_Buffer __pyx_pybuffer_q_grad_u;
12012  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_w;
12013  __Pyx_Buffer __pyx_pybuffer_q_grad_w;
12014  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr;
12015  __Pyx_Buffer __pyx_pybuffer_q_kr;
12016  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr_up;
12017  __Pyx_Buffer __pyx_pybuffer_q_kr_up;
12018  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_m;
12019  __Pyx_Buffer __pyx_pybuffer_q_m;
12020  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_mt;
12021  __Pyx_Buffer __pyx_pybuffer_q_mt;
12022  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_r;
12023  __Pyx_Buffer __pyx_pybuffer_q_r;
12024  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_u;
12025  __Pyx_Buffer __pyx_pybuffer_q_u;
12026  __Pyx_LocalBuf_ND __pyx_pybuffernd_rowptr;
12027  __Pyx_Buffer __pyx_pybuffer_rowptr;
12028  PyObject *__pyx_r = NULL;
12029  __Pyx_RefNannyDeclarations
12030  PyObject *__pyx_t_1 = NULL;
12031  PyObject *__pyx_t_2 = NULL;
12032  Py_ssize_t __pyx_t_3;
12033  PyObject *__pyx_t_4 = NULL;
12034  PyObject *__pyx_t_5 = NULL;
12035  int __pyx_t_6;
12036  Py_ssize_t __pyx_t_7;
12037  int __pyx_t_8;
12038  PyObject *__pyx_t_9 = NULL;
12039  PyArrayObject *__pyx_t_10 = NULL;
12040  PyArrayObject *__pyx_t_11 = NULL;
12041  double __pyx_t_12;
12042  int __pyx_t_13;
12043  int __pyx_t_14;
12044  Py_ssize_t __pyx_t_15;
12045  Py_ssize_t __pyx_t_16;
12046  int __pyx_t_17;
12047  int __pyx_t_18;
12048  int __pyx_t_19;
12049  Py_ssize_t __pyx_t_20;
12050  Py_ssize_t __pyx_t_21;
12051  int __pyx_t_22;
12052  Py_ssize_t __pyx_t_23;
12053  Py_ssize_t __pyx_t_24;
12054  Py_ssize_t __pyx_t_25;
12055  Py_ssize_t __pyx_t_26;
12056  Py_ssize_t __pyx_t_27;
12057  Py_ssize_t __pyx_t_28;
12058  int __pyx_t_29;
12059  int __pyx_t_30;
12060  int __pyx_t_31;
12061  int __pyx_t_32;
12062  int __pyx_t_33;
12063  Py_ssize_t __pyx_t_34;
12064  Py_ssize_t __pyx_t_35;
12065  Py_ssize_t __pyx_t_36;
12066  int __pyx_t_37;
12067  Py_ssize_t __pyx_t_38;
12068  Py_ssize_t __pyx_t_39;
12069  Py_ssize_t __pyx_t_40;
12070  Py_ssize_t __pyx_t_41;
12071  Py_ssize_t __pyx_t_42;
12072  Py_ssize_t __pyx_t_43;
12073  Py_ssize_t __pyx_t_44;
12074  Py_ssize_t __pyx_t_45;
12075  Py_ssize_t __pyx_t_46;
12076  Py_ssize_t __pyx_t_47;
12077  Py_ssize_t __pyx_t_48;
12078  Py_ssize_t __pyx_t_49;
12079  Py_ssize_t __pyx_t_50;
12080  Py_ssize_t __pyx_t_51;
12081  Py_ssize_t __pyx_t_52;
12082  Py_ssize_t __pyx_t_53;
12083  Py_ssize_t __pyx_t_54;
12084  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_55;
12085  Py_ssize_t __pyx_t_56;
12086  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_57;
12087  Py_ssize_t __pyx_t_58;
12088  int __pyx_t_59;
12089  Py_ssize_t __pyx_t_60;
12090  Py_ssize_t __pyx_t_61;
12091  Py_ssize_t __pyx_t_62;
12092  Py_ssize_t __pyx_t_63;
12093  Py_ssize_t __pyx_t_64;
12094  Py_ssize_t __pyx_t_65;
12095  Py_ssize_t __pyx_t_66;
12096  Py_ssize_t __pyx_t_67;
12097  Py_ssize_t __pyx_t_68;
12098  Py_ssize_t __pyx_t_69;
12099  __Pyx_RefNannySetupContext("RE_NCP1_getElementResidual", 0);
12100  __pyx_pybuffer_a_up.pybuffer.buf = NULL;
12101  __pyx_pybuffer_a_up.refcount = 0;
12102  __pyx_pybuffernd_a_up.data = NULL;
12103  __pyx_pybuffernd_a_up.rcbuffer = &__pyx_pybuffer_a_up;
12104  __pyx_pybuffer_f_up.pybuffer.buf = NULL;
12105  __pyx_pybuffer_f_up.refcount = 0;
12106  __pyx_pybuffernd_f_up.data = NULL;
12107  __pyx_pybuffernd_f_up.rcbuffer = &__pyx_pybuffer_f_up;
12108  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
12109  __pyx_pybuffer_gravity.refcount = 0;
12110  __pyx_pybuffernd_gravity.data = NULL;
12111  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
12112  __pyx_pybuffer_rowptr.pybuffer.buf = NULL;
12113  __pyx_pybuffer_rowptr.refcount = 0;
12114  __pyx_pybuffernd_rowptr.data = NULL;
12115  __pyx_pybuffernd_rowptr.rcbuffer = &__pyx_pybuffer_rowptr;
12116  __pyx_pybuffer_colind.pybuffer.buf = NULL;
12117  __pyx_pybuffer_colind.refcount = 0;
12118  __pyx_pybuffernd_colind.data = NULL;
12119  __pyx_pybuffernd_colind.rcbuffer = &__pyx_pybuffer_colind;
12120  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
12121  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
12122  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
12123  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
12124  __pyx_pybuffer_elementBarycentersArray.pybuffer.buf = NULL;
12125  __pyx_pybuffer_elementBarycentersArray.refcount = 0;
12126  __pyx_pybuffernd_elementBarycentersArray.data = NULL;
12127  __pyx_pybuffernd_elementBarycentersArray.rcbuffer = &__pyx_pybuffer_elementBarycentersArray;
12128  __pyx_pybuffer_q_u.pybuffer.buf = NULL;
12129  __pyx_pybuffer_q_u.refcount = 0;
12130  __pyx_pybuffernd_q_u.data = NULL;
12131  __pyx_pybuffernd_q_u.rcbuffer = &__pyx_pybuffer_q_u;
12132  __pyx_pybuffer_q_grad_u.pybuffer.buf = NULL;
12133  __pyx_pybuffer_q_grad_u.refcount = 0;
12134  __pyx_pybuffernd_q_grad_u.data = NULL;
12135  __pyx_pybuffernd_q_grad_u.rcbuffer = &__pyx_pybuffer_q_grad_u;
12136  __pyx_pybuffer_q_grad_w.pybuffer.buf = NULL;
12137  __pyx_pybuffer_q_grad_w.refcount = 0;
12138  __pyx_pybuffernd_q_grad_w.data = NULL;
12139  __pyx_pybuffernd_q_grad_w.rcbuffer = &__pyx_pybuffer_q_grad_w;
12140  __pyx_pybuffer_q_detJ.pybuffer.buf = NULL;
12141  __pyx_pybuffer_q_detJ.refcount = 0;
12142  __pyx_pybuffernd_q_detJ.data = NULL;
12143  __pyx_pybuffernd_q_detJ.rcbuffer = &__pyx_pybuffer_q_detJ;
12144  __pyx_pybuffer_q_m.pybuffer.buf = NULL;
12145  __pyx_pybuffer_q_m.refcount = 0;
12146  __pyx_pybuffernd_q_m.data = NULL;
12147  __pyx_pybuffernd_q_m.rcbuffer = &__pyx_pybuffer_q_m;
12148  __pyx_pybuffer_q_mt.pybuffer.buf = NULL;
12149  __pyx_pybuffer_q_mt.refcount = 0;
12150  __pyx_pybuffernd_q_mt.data = NULL;
12151  __pyx_pybuffernd_q_mt.rcbuffer = &__pyx_pybuffer_q_mt;
12152  __pyx_pybuffer_q_r.pybuffer.buf = NULL;
12153  __pyx_pybuffer_q_r.refcount = 0;
12154  __pyx_pybuffernd_q_r.data = NULL;
12155  __pyx_pybuffernd_q_r.rcbuffer = &__pyx_pybuffer_q_r;
12156  __pyx_pybuffer_q_kr.pybuffer.buf = NULL;
12157  __pyx_pybuffer_q_kr.refcount = 0;
12158  __pyx_pybuffernd_q_kr.data = NULL;
12159  __pyx_pybuffernd_q_kr.rcbuffer = &__pyx_pybuffer_q_kr;
12160  __pyx_pybuffer_q_kr_up.pybuffer.buf = NULL;
12161  __pyx_pybuffer_q_kr_up.refcount = 0;
12162  __pyx_pybuffernd_q_kr_up.data = NULL;
12163  __pyx_pybuffernd_q_kr_up.rcbuffer = &__pyx_pybuffer_q_kr_up;
12164  __pyx_pybuffer_q_flin.pybuffer.buf = NULL;
12165  __pyx_pybuffer_q_flin.refcount = 0;
12166  __pyx_pybuffernd_q_flin.data = NULL;
12167  __pyx_pybuffernd_q_flin.rcbuffer = &__pyx_pybuffer_q_flin;
12168  __pyx_pybuffer_q_alin.pybuffer.buf = NULL;
12169  __pyx_pybuffer_q_alin.refcount = 0;
12170  __pyx_pybuffernd_q_alin.data = NULL;
12171  __pyx_pybuffernd_q_alin.rcbuffer = &__pyx_pybuffer_q_alin;
12172  __pyx_pybuffer_elementResidual.pybuffer.buf = NULL;
12173  __pyx_pybuffer_elementResidual.refcount = 0;
12174  __pyx_pybuffernd_elementResidual.data = NULL;
12175  __pyx_pybuffernd_elementResidual.rcbuffer = &__pyx_pybuffer_elementResidual;
12176  {
12177  __Pyx_BufFmt_StackElem __pyx_stack[1];
12178  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12179  }
12180  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
12181  {
12182  __Pyx_BufFmt_StackElem __pyx_stack[1];
12183  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_rowptr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12184  }
12185  __pyx_pybuffernd_rowptr.diminfo[0].strides = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rowptr.diminfo[0].shape = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.shape[0];
12186  {
12187  __Pyx_BufFmt_StackElem __pyx_stack[1];
12188  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_colind.rcbuffer->pybuffer, (PyObject*)__pyx_v_colind, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12189  }
12190  __pyx_pybuffernd_colind.diminfo[0].strides = __pyx_pybuffernd_colind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_colind.diminfo[0].shape = __pyx_pybuffernd_colind.rcbuffer->pybuffer.shape[0];
12191  {
12192  __Pyx_BufFmt_StackElem __pyx_stack[1];
12193  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12194  }
12195  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
12196  {
12197  __Pyx_BufFmt_StackElem __pyx_stack[1];
12198  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBarycentersArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12199  }
12200  __pyx_pybuffernd_elementBarycentersArray.diminfo[0].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[0].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[1];
12201  {
12202  __Pyx_BufFmt_StackElem __pyx_stack[1];
12203  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12204  }
12205  __pyx_pybuffernd_q_u.diminfo[0].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_u.diminfo[0].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_u.diminfo[1].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_u.diminfo[1].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[1];
12206  {
12207  __Pyx_BufFmt_StackElem __pyx_stack[1];
12208  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12209  }
12210  __pyx_pybuffernd_q_grad_u.diminfo[0].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_u.diminfo[0].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_u.diminfo[1].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_u.diminfo[1].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_u.diminfo[2].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_u.diminfo[2].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[2];
12211  {
12212  __Pyx_BufFmt_StackElem __pyx_stack[1];
12213  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12214  }
12215  __pyx_pybuffernd_q_grad_w.diminfo[0].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_w.diminfo[0].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_w.diminfo[1].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_w.diminfo[1].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_w.diminfo[2].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_w.diminfo[2].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_q_grad_w.diminfo[3].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_q_grad_w.diminfo[3].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[3];
12216  {
12217  __Pyx_BufFmt_StackElem __pyx_stack[1];
12218  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_detJ, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12219  }
12220  __pyx_pybuffernd_q_detJ.diminfo[0].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_detJ.diminfo[0].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_detJ.diminfo[1].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_detJ.diminfo[1].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[1];
12221  {
12222  __Pyx_BufFmt_StackElem __pyx_stack[1];
12223  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_m, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12224  }
12225  __pyx_pybuffernd_q_m.diminfo[0].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_m.diminfo[0].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_m.diminfo[1].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_m.diminfo[1].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[1];
12226  {
12227  __Pyx_BufFmt_StackElem __pyx_stack[1];
12228  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_mt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12229  }
12230  __pyx_pybuffernd_q_mt.diminfo[0].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_mt.diminfo[0].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_mt.diminfo[1].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_mt.diminfo[1].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[1];
12231  {
12232  __Pyx_BufFmt_StackElem __pyx_stack[1];
12233  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_r, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12234  }
12235  __pyx_pybuffernd_q_r.diminfo[0].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_r.diminfo[0].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_r.diminfo[1].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_r.diminfo[1].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[1];
12236  {
12237  __Pyx_BufFmt_StackElem __pyx_stack[1];
12238  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12239  }
12240  __pyx_pybuffernd_q_kr.diminfo[0].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr.diminfo[0].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr.diminfo[1].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr.diminfo[1].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[1];
12241  {
12242  __Pyx_BufFmt_StackElem __pyx_stack[1];
12243  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr_up, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12244  }
12245  __pyx_pybuffernd_q_kr_up.diminfo[0].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr_up.diminfo[0].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr_up.diminfo[1].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr_up.diminfo[1].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[1];
12246  {
12247  __Pyx_BufFmt_StackElem __pyx_stack[1];
12248  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_flin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12249  }
12250  __pyx_pybuffernd_q_flin.diminfo[0].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_flin.diminfo[0].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_flin.diminfo[1].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_flin.diminfo[1].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_flin.diminfo[2].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_flin.diminfo[2].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[2];
12251  {
12252  __Pyx_BufFmt_StackElem __pyx_stack[1];
12253  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_alin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12254  }
12255  __pyx_pybuffernd_q_alin.diminfo[0].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_alin.diminfo[0].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_alin.diminfo[1].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_alin.diminfo[1].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_alin.diminfo[2].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_alin.diminfo[2].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[2];
12256  {
12257  __Pyx_BufFmt_StackElem __pyx_stack[1];
12258  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementResidual.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementResidual, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12259  }
12260  __pyx_pybuffernd_elementResidual.diminfo[0].strides = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementResidual.diminfo[0].shape = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementResidual.diminfo[1].strides = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementResidual.diminfo[1].shape = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.shape[1];
12261 
12262  /* "subsurfaceTransportFunctions.pyx":527
12263  *
12264  * """
12265  * cdef int upwindFlag = 1 # <<<<<<<<<<<<<<
12266  * #check some sizes
12267  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
12268  */
12269  __pyx_v_upwindFlag = 1;
12270 
12271  /* "subsurfaceTransportFunctions.pyx":529
12272  * cdef int upwindFlag = 1
12273  * #check some sizes
12274  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
12275  * assert q.shape[1] == nSpace+1
12276  * assert nDOF_test_element == nSpace+1
12277  */
12278  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error)
12279  __Pyx_GOTREF(__pyx_t_1);
12280  __Pyx_INCREF(((PyObject *)__pyx_v_q_u));
12281  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_u));
12282  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_q_u));
12283  __Pyx_INCREF(((PyObject *)__pyx_v_q_m));
12284  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_m));
12285  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_q_m));
12286  __Pyx_INCREF(((PyObject *)__pyx_v_q_mt));
12287  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_mt));
12288  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_q_mt));
12289  __Pyx_INCREF(((PyObject *)__pyx_v_q_r));
12290  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_r));
12291  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_q_r));
12292  __Pyx_INCREF(((PyObject *)__pyx_v_q_kr));
12293  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_kr));
12294  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_q_kr));
12295  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
12296  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12297  for (;;) {
12298  if (__pyx_t_3 >= 5) break;
12299  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12300  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 529, __pyx_L1_error)
12301  #else
12302  __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error)
12303  __Pyx_GOTREF(__pyx_t_1);
12304  #endif
12305  __Pyx_XDECREF_SET(__pyx_v_q, __pyx_t_1);
12306  __pyx_t_1 = 0;
12307 
12308  /* "subsurfaceTransportFunctions.pyx":530
12309  * #check some sizes
12310  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
12311  * assert q.shape[1] == nSpace+1 # <<<<<<<<<<<<<<
12312  * assert nDOF_test_element == nSpace+1
12313  * cdef int nnz = rowptr[nSpace]
12314  */
12315  #ifndef CYTHON_WITHOUT_ASSERTIONS
12316  if (unlikely(!Py_OptimizeFlag)) {
12317  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_q, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error)
12318  __Pyx_GOTREF(__pyx_t_1);
12319  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 530, __pyx_L1_error)
12320  __Pyx_GOTREF(__pyx_t_4);
12321  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12322  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_nSpace + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error)
12323  __Pyx_GOTREF(__pyx_t_1);
12324  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 530, __pyx_L1_error)
12325  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12326  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12327  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 530, __pyx_L1_error)
12328  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12329  if (unlikely(!__pyx_t_6)) {
12330  PyErr_SetNone(PyExc_AssertionError);
12331  __PYX_ERR(0, 530, __pyx_L1_error)
12332  }
12333  }
12334  #endif
12335 
12336  /* "subsurfaceTransportFunctions.pyx":529
12337  * cdef int upwindFlag = 1
12338  * #check some sizes
12339  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
12340  * assert q.shape[1] == nSpace+1
12341  * assert nDOF_test_element == nSpace+1
12342  */
12343  }
12344  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12345 
12346  /* "subsurfaceTransportFunctions.pyx":531
12347  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
12348  * assert q.shape[1] == nSpace+1
12349  * assert nDOF_test_element == nSpace+1 # <<<<<<<<<<<<<<
12350  * cdef int nnz = rowptr[nSpace]
12351  * #temporaries
12352  */
12353  #ifndef CYTHON_WITHOUT_ASSERTIONS
12354  if (unlikely(!Py_OptimizeFlag)) {
12355  if (unlikely(!((__pyx_v_nDOF_test_element == (__pyx_v_nSpace + 1)) != 0))) {
12356  PyErr_SetNone(PyExc_AssertionError);
12357  __PYX_ERR(0, 531, __pyx_L1_error)
12358  }
12359  }
12360  #endif
12361 
12362  /* "subsurfaceTransportFunctions.pyx":532
12363  * assert q.shape[1] == nSpace+1
12364  * assert nDOF_test_element == nSpace+1
12365  * cdef int nnz = rowptr[nSpace] # <<<<<<<<<<<<<<
12366  * #temporaries
12367  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig
12368  */
12369  __pyx_t_7 = __pyx_v_nSpace;
12370  __pyx_t_8 = -1;
12371  if (__pyx_t_7 < 0) {
12372  __pyx_t_7 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
12373  if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 0;
12374  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_8 = 0;
12375  if (unlikely(__pyx_t_8 != -1)) {
12376  __Pyx_RaiseBufferIndexError(__pyx_t_8);
12377  __PYX_ERR(0, 532, __pyx_L1_error)
12378  }
12379  __pyx_v_nnz = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_rowptr.diminfo[0].strides));
12380 
12381  /* "subsurfaceTransportFunctions.pyx":536
12382  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig
12383  * cdef int eN,eN_neighbor,ii,I,i,ebN
12384  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
12385  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
12386  * #for averaging/integration weights
12387  */
12388  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 536, __pyx_L1_error)
12389  __Pyx_GOTREF(__pyx_t_5);
12390  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error)
12391  __Pyx_GOTREF(__pyx_t_1);
12392  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12393  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 536, __pyx_L1_error)
12394  __Pyx_GOTREF(__pyx_t_5);
12395  __pyx_t_4 = NULL;
12396  __pyx_t_8 = 0;
12397  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
12398  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
12399  if (likely(__pyx_t_4)) {
12400  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
12401  __Pyx_INCREF(__pyx_t_4);
12402  __Pyx_INCREF(function);
12403  __Pyx_DECREF_SET(__pyx_t_1, function);
12404  __pyx_t_8 = 1;
12405  }
12406  }
12407  #if CYTHON_FAST_PYCALL
12408  if (PyFunction_Check(__pyx_t_1)) {
12409  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
12410  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error)
12411  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
12412  __Pyx_GOTREF(__pyx_t_2);
12413  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12414  } else
12415  #endif
12416  #if CYTHON_FAST_PYCCALL
12417  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
12418  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
12419  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error)
12420  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
12421  __Pyx_GOTREF(__pyx_t_2);
12422  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12423  } else
12424  #endif
12425  {
12426  __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 536, __pyx_L1_error)
12427  __Pyx_GOTREF(__pyx_t_9);
12428  if (__pyx_t_4) {
12429  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL;
12430  }
12431  __Pyx_GIVEREF(__pyx_t_5);
12432  PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_5);
12433  __Pyx_INCREF(__pyx_n_s_d);
12434  __Pyx_GIVEREF(__pyx_n_s_d);
12435  PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_n_s_d);
12436  __pyx_t_5 = 0;
12437  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error)
12438  __Pyx_GOTREF(__pyx_t_2);
12439  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12440  }
12441  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12442  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 536, __pyx_L1_error)
12443  __pyx_t_10 = ((PyArrayObject *)__pyx_t_2);
12444  {
12445  __Pyx_BufFmt_StackElem __pyx_stack[1];
12446  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
12447  __pyx_v_a_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf = NULL;
12448  __PYX_ERR(0, 536, __pyx_L1_error)
12449  } else {__pyx_pybuffernd_a_up.diminfo[0].strides = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_up.diminfo[0].shape = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.shape[0];
12450  }
12451  }
12452  __pyx_t_10 = 0;
12453  __pyx_v_a_up = ((PyArrayObject *)__pyx_t_2);
12454  __pyx_t_2 = 0;
12455 
12456  /* "subsurfaceTransportFunctions.pyx":537
12457  * cdef int eN,eN_neighbor,ii,I,i,ebN
12458  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d')
12459  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d') # <<<<<<<<<<<<<<
12460  * #for averaging/integration weights
12461  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12462  */
12463  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error)
12464  __Pyx_GOTREF(__pyx_t_1);
12465  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 537, __pyx_L1_error)
12466  __Pyx_GOTREF(__pyx_t_9);
12467  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12468  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nSpace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error)
12469  __Pyx_GOTREF(__pyx_t_1);
12470  __pyx_t_5 = NULL;
12471  __pyx_t_8 = 0;
12472  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
12473  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
12474  if (likely(__pyx_t_5)) {
12475  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
12476  __Pyx_INCREF(__pyx_t_5);
12477  __Pyx_INCREF(function);
12478  __Pyx_DECREF_SET(__pyx_t_9, function);
12479  __pyx_t_8 = 1;
12480  }
12481  }
12482  #if CYTHON_FAST_PYCALL
12483  if (PyFunction_Check(__pyx_t_9)) {
12484  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_n_s_d};
12485  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 537, __pyx_L1_error)
12486  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12487  __Pyx_GOTREF(__pyx_t_2);
12488  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12489  } else
12490  #endif
12491  #if CYTHON_FAST_PYCCALL
12492  if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
12493  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_n_s_d};
12494  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 537, __pyx_L1_error)
12495  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12496  __Pyx_GOTREF(__pyx_t_2);
12497  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12498  } else
12499  #endif
12500  {
12501  __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 537, __pyx_L1_error)
12502  __Pyx_GOTREF(__pyx_t_4);
12503  if (__pyx_t_5) {
12504  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
12505  }
12506  __Pyx_GIVEREF(__pyx_t_1);
12507  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_t_1);
12508  __Pyx_INCREF(__pyx_n_s_d);
12509  __Pyx_GIVEREF(__pyx_n_s_d);
12510  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_n_s_d);
12511  __pyx_t_1 = 0;
12512  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 537, __pyx_L1_error)
12513  __Pyx_GOTREF(__pyx_t_2);
12514  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12515  }
12516  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12517  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 537, __pyx_L1_error)
12518  __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
12519  {
12520  __Pyx_BufFmt_StackElem __pyx_stack[1];
12521  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
12522  __pyx_v_f_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf = NULL;
12523  __PYX_ERR(0, 537, __pyx_L1_error)
12524  } else {__pyx_pybuffernd_f_up.diminfo[0].strides = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f_up.diminfo[0].shape = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.shape[0];
12525  }
12526  }
12527  __pyx_t_11 = 0;
12528  __pyx_v_f_up = ((PyArrayObject *)__pyx_t_2);
12529  __pyx_t_2 = 0;
12530 
12531  /* "subsurfaceTransportFunctions.pyx":539
12532  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
12533  * #for averaging/integration weights
12534  * cdef double nAvgWeight = 1.0/(nSpace+1.) # <<<<<<<<<<<<<<
12535  * cdef double weight=1.0,volFactor = 1.0
12536  * if nSpace == 2:
12537  */
12538  __pyx_t_12 = (__pyx_v_nSpace + 1.);
12539  if (unlikely(__pyx_t_12 == 0)) {
12540  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
12541  __PYX_ERR(0, 539, __pyx_L1_error)
12542  }
12543  __pyx_v_nAvgWeight = (1.0 / __pyx_t_12);
12544 
12545  /* "subsurfaceTransportFunctions.pyx":540
12546  * #for averaging/integration weights
12547  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12548  * cdef double weight=1.0,volFactor = 1.0 # <<<<<<<<<<<<<<
12549  * if nSpace == 2:
12550  * volFactor = 0.5
12551  */
12552  __pyx_v_weight = 1.0;
12553  __pyx_v_volFactor = 1.0;
12554 
12555  /* "subsurfaceTransportFunctions.pyx":541
12556  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12557  * cdef double weight=1.0,volFactor = 1.0
12558  * if nSpace == 2: # <<<<<<<<<<<<<<
12559  * volFactor = 0.5
12560  * if nSpace == 3:
12561  */
12562  __pyx_t_6 = ((__pyx_v_nSpace == 2) != 0);
12563  if (__pyx_t_6) {
12564 
12565  /* "subsurfaceTransportFunctions.pyx":542
12566  * cdef double weight=1.0,volFactor = 1.0
12567  * if nSpace == 2:
12568  * volFactor = 0.5 # <<<<<<<<<<<<<<
12569  * if nSpace == 3:
12570  * volFactor = 1.0/6.0
12571  */
12572  __pyx_v_volFactor = 0.5;
12573 
12574  /* "subsurfaceTransportFunctions.pyx":541
12575  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12576  * cdef double weight=1.0,volFactor = 1.0
12577  * if nSpace == 2: # <<<<<<<<<<<<<<
12578  * volFactor = 0.5
12579  * if nSpace == 3:
12580  */
12581  }
12582 
12583  /* "subsurfaceTransportFunctions.pyx":543
12584  * if nSpace == 2:
12585  * volFactor = 0.5
12586  * if nSpace == 3: # <<<<<<<<<<<<<<
12587  * volFactor = 1.0/6.0
12588  * #
12589  */
12590  __pyx_t_6 = ((__pyx_v_nSpace == 3) != 0);
12591  if (__pyx_t_6) {
12592 
12593  /* "subsurfaceTransportFunctions.pyx":544
12594  * volFactor = 0.5
12595  * if nSpace == 3:
12596  * volFactor = 1.0/6.0 # <<<<<<<<<<<<<<
12597  * #
12598  * for eN in range(nElements_global):
12599  */
12600  __pyx_v_volFactor = (1.0 / 6.0);
12601 
12602  /* "subsurfaceTransportFunctions.pyx":543
12603  * if nSpace == 2:
12604  * volFactor = 0.5
12605  * if nSpace == 3: # <<<<<<<<<<<<<<
12606  * volFactor = 1.0/6.0
12607  * #
12608  */
12609  }
12610 
12611  /* "subsurfaceTransportFunctions.pyx":546
12612  * volFactor = 1.0/6.0
12613  * #
12614  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
12615  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
12616  * weight = nAvgWeight*volume
12617  */
12618  __pyx_t_8 = __pyx_v_nElements_global;
12619  __pyx_t_13 = __pyx_t_8;
12620  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
12621  __pyx_v_eN = __pyx_t_14;
12622 
12623  /* "subsurfaceTransportFunctions.pyx":547
12624  * #
12625  * for eN in range(nElements_global):
12626  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation # <<<<<<<<<<<<<<
12627  * weight = nAvgWeight*volume
12628  *
12629  */
12630  __pyx_t_15 = __pyx_v_eN;
12631  __pyx_t_16 = 0;
12632  __pyx_t_17 = -1;
12633  if (__pyx_t_15 < 0) {
12634  __pyx_t_15 += __pyx_pybuffernd_q_detJ.diminfo[0].shape;
12635  if (unlikely(__pyx_t_15 < 0)) __pyx_t_17 = 0;
12636  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_detJ.diminfo[0].shape)) __pyx_t_17 = 0;
12637  if (__pyx_t_16 < 0) {
12638  __pyx_t_16 += __pyx_pybuffernd_q_detJ.diminfo[1].shape;
12639  if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 1;
12640  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_q_detJ.diminfo[1].shape)) __pyx_t_17 = 1;
12641  if (unlikely(__pyx_t_17 != -1)) {
12642  __Pyx_RaiseBufferIndexError(__pyx_t_17);
12643  __PYX_ERR(0, 547, __pyx_L1_error)
12644  }
12645  __pyx_v_volume = (__pyx_v_volFactor * fabs((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_q_detJ.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_q_detJ.diminfo[1].strides))));
12646 
12647  /* "subsurfaceTransportFunctions.pyx":548
12648  * for eN in range(nElements_global):
12649  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
12650  * weight = nAvgWeight*volume # <<<<<<<<<<<<<<
12651  *
12652  * for i in range(nDOF_test_element):
12653  */
12654  __pyx_v_weight = (__pyx_v_nAvgWeight * __pyx_v_volume);
12655 
12656  /* "subsurfaceTransportFunctions.pyx":550
12657  * weight = nAvgWeight*volume
12658  *
12659  * for i in range(nDOF_test_element): # <<<<<<<<<<<<<<
12660  * #nodal quadrature so diagonal
12661  * ##mass
12662  */
12663  __pyx_t_17 = __pyx_v_nDOF_test_element;
12664  __pyx_t_18 = __pyx_t_17;
12665  for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
12666  __pyx_v_i = __pyx_t_19;
12667 
12668  /* "subsurfaceTransportFunctions.pyx":553
12669  * #nodal quadrature so diagonal
12670  * ##mass
12671  * elementResidual[eN,i] += weight*q_mt[eN,i] # <<<<<<<<<<<<<<
12672  * ##sources
12673  * elementResidual[eN,i] += weight*q_r[eN,i]
12674  */
12675  __pyx_t_20 = __pyx_v_eN;
12676  __pyx_t_21 = __pyx_v_i;
12677  __pyx_t_22 = -1;
12678  if (__pyx_t_20 < 0) {
12679  __pyx_t_20 += __pyx_pybuffernd_q_mt.diminfo[0].shape;
12680  if (unlikely(__pyx_t_20 < 0)) __pyx_t_22 = 0;
12681  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_q_mt.diminfo[0].shape)) __pyx_t_22 = 0;
12682  if (__pyx_t_21 < 0) {
12683  __pyx_t_21 += __pyx_pybuffernd_q_mt.diminfo[1].shape;
12684  if (unlikely(__pyx_t_21 < 0)) __pyx_t_22 = 1;
12685  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_q_mt.diminfo[1].shape)) __pyx_t_22 = 1;
12686  if (unlikely(__pyx_t_22 != -1)) {
12687  __Pyx_RaiseBufferIndexError(__pyx_t_22);
12688  __PYX_ERR(0, 553, __pyx_L1_error)
12689  }
12690  __pyx_t_23 = __pyx_v_eN;
12691  __pyx_t_24 = __pyx_v_i;
12692  __pyx_t_22 = -1;
12693  if (__pyx_t_23 < 0) {
12694  __pyx_t_23 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
12695  if (unlikely(__pyx_t_23 < 0)) __pyx_t_22 = 0;
12696  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_22 = 0;
12697  if (__pyx_t_24 < 0) {
12698  __pyx_t_24 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
12699  if (unlikely(__pyx_t_24 < 0)) __pyx_t_22 = 1;
12700  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_22 = 1;
12701  if (unlikely(__pyx_t_22 != -1)) {
12702  __Pyx_RaiseBufferIndexError(__pyx_t_22);
12703  __PYX_ERR(0, 553, __pyx_L1_error)
12704  }
12705  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_elementResidual.diminfo[1].strides) += (__pyx_v_weight * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_q_mt.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_q_mt.diminfo[1].strides)));
12706 
12707  /* "subsurfaceTransportFunctions.pyx":555
12708  * elementResidual[eN,i] += weight*q_mt[eN,i]
12709  * ##sources
12710  * elementResidual[eN,i] += weight*q_r[eN,i] # <<<<<<<<<<<<<<
12711  *
12712  * #have to actually compute loop over other nodes for stiffness terms
12713  */
12714  __pyx_t_25 = __pyx_v_eN;
12715  __pyx_t_26 = __pyx_v_i;
12716  __pyx_t_22 = -1;
12717  if (__pyx_t_25 < 0) {
12718  __pyx_t_25 += __pyx_pybuffernd_q_r.diminfo[0].shape;
12719  if (unlikely(__pyx_t_25 < 0)) __pyx_t_22 = 0;
12720  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_q_r.diminfo[0].shape)) __pyx_t_22 = 0;
12721  if (__pyx_t_26 < 0) {
12722  __pyx_t_26 += __pyx_pybuffernd_q_r.diminfo[1].shape;
12723  if (unlikely(__pyx_t_26 < 0)) __pyx_t_22 = 1;
12724  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_q_r.diminfo[1].shape)) __pyx_t_22 = 1;
12725  if (unlikely(__pyx_t_22 != -1)) {
12726  __Pyx_RaiseBufferIndexError(__pyx_t_22);
12727  __PYX_ERR(0, 555, __pyx_L1_error)
12728  }
12729  __pyx_t_27 = __pyx_v_eN;
12730  __pyx_t_28 = __pyx_v_i;
12731  __pyx_t_22 = -1;
12732  if (__pyx_t_27 < 0) {
12733  __pyx_t_27 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
12734  if (unlikely(__pyx_t_27 < 0)) __pyx_t_22 = 0;
12735  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_22 = 0;
12736  if (__pyx_t_28 < 0) {
12737  __pyx_t_28 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
12738  if (unlikely(__pyx_t_28 < 0)) __pyx_t_22 = 1;
12739  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_22 = 1;
12740  if (unlikely(__pyx_t_22 != -1)) {
12741  __Pyx_RaiseBufferIndexError(__pyx_t_22);
12742  __PYX_ERR(0, 555, __pyx_L1_error)
12743  }
12744  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_elementResidual.diminfo[1].strides) += (__pyx_v_weight * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_r.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_q_r.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_q_r.diminfo[1].strides)));
12745 
12746  /* "subsurfaceTransportFunctions.pyx":558
12747  *
12748  * #have to actually compute loop over other nodes for stiffness terms
12749  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_ # <<<<<<<<<<<<<<
12750  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
12751  * for ii in range(nnz):
12752  */
12753  __pyx_t_22 = __pyx_v_nElementBoundaries_element;
12754  __pyx_t_29 = __pyx_t_22;
12755  for (__pyx_t_30 = 0; __pyx_t_30 < __pyx_t_29; __pyx_t_30+=1) {
12756  __pyx_v_ebN = __pyx_t_30;
12757 
12758  /* "subsurfaceTransportFunctions.pyx":560
12759  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_
12760  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
12761  * for ii in range(nnz): # <<<<<<<<<<<<<<
12762  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
12763  * for I in range(nSpace):
12764  */
12765  __pyx_t_31 = __pyx_v_nnz;
12766  __pyx_t_32 = __pyx_t_31;
12767  for (__pyx_t_33 = 0; __pyx_t_33 < __pyx_t_32; __pyx_t_33+=1) {
12768  __pyx_v_ii = __pyx_t_33;
12769 
12770  /* "subsurfaceTransportFunctions.pyx":561
12771  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
12772  * for ii in range(nnz):
12773  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
12774  * for I in range(nSpace):
12775  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
12776  */
12777  __pyx_t_34 = __pyx_v_eN;
12778  __pyx_t_35 = __pyx_v_ebN;
12779  __pyx_t_36 = __pyx_v_ii;
12780  __pyx_t_37 = -1;
12781  if (__pyx_t_34 < 0) {
12782  __pyx_t_34 += __pyx_pybuffernd_q_alin.diminfo[0].shape;
12783  if (unlikely(__pyx_t_34 < 0)) __pyx_t_37 = 0;
12784  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_q_alin.diminfo[0].shape)) __pyx_t_37 = 0;
12785  if (__pyx_t_35 < 0) {
12786  __pyx_t_35 += __pyx_pybuffernd_q_alin.diminfo[1].shape;
12787  if (unlikely(__pyx_t_35 < 0)) __pyx_t_37 = 1;
12788  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_q_alin.diminfo[1].shape)) __pyx_t_37 = 1;
12789  if (__pyx_t_36 < 0) {
12790  __pyx_t_36 += __pyx_pybuffernd_q_alin.diminfo[2].shape;
12791  if (unlikely(__pyx_t_36 < 0)) __pyx_t_37 = 2;
12792  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_q_alin.diminfo[2].shape)) __pyx_t_37 = 2;
12793  if (unlikely(__pyx_t_37 != -1)) {
12794  __Pyx_RaiseBufferIndexError(__pyx_t_37);
12795  __PYX_ERR(0, 561, __pyx_L1_error)
12796  }
12797  __pyx_t_38 = __pyx_v_eN;
12798  __pyx_t_39 = __pyx_v_ebN;
12799  __pyx_t_37 = -1;
12800  if (__pyx_t_38 < 0) {
12801  __pyx_t_38 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
12802  if (unlikely(__pyx_t_38 < 0)) __pyx_t_37 = 0;
12803  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_37 = 0;
12804  if (__pyx_t_39 < 0) {
12805  __pyx_t_39 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
12806  if (unlikely(__pyx_t_39 < 0)) __pyx_t_37 = 1;
12807  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_37 = 1;
12808  if (unlikely(__pyx_t_37 != -1)) {
12809  __Pyx_RaiseBufferIndexError(__pyx_t_37);
12810  __PYX_ERR(0, 561, __pyx_L1_error)
12811  }
12812  __pyx_t_40 = __pyx_v_ii;
12813  __pyx_t_37 = -1;
12814  if (__pyx_t_40 < 0) {
12815  __pyx_t_40 += __pyx_pybuffernd_a_up.diminfo[0].shape;
12816  if (unlikely(__pyx_t_40 < 0)) __pyx_t_37 = 0;
12817  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_37 = 0;
12818  if (unlikely(__pyx_t_37 != -1)) {
12819  __Pyx_RaiseBufferIndexError(__pyx_t_37);
12820  __PYX_ERR(0, 561, __pyx_L1_error)
12821  }
12822  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_a_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_q_alin.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_q_alin.diminfo[1].strides, __pyx_t_36, __pyx_pybuffernd_q_alin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
12823  }
12824 
12825  /* "subsurfaceTransportFunctions.pyx":562
12826  * for ii in range(nnz):
12827  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
12828  * for I in range(nSpace): # <<<<<<<<<<<<<<
12829  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
12830  * #
12831  */
12832  __pyx_t_31 = __pyx_v_nSpace;
12833  __pyx_t_32 = __pyx_t_31;
12834  for (__pyx_t_33 = 0; __pyx_t_33 < __pyx_t_32; __pyx_t_33+=1) {
12835  __pyx_v_I = __pyx_t_33;
12836 
12837  /* "subsurfaceTransportFunctions.pyx":563
12838  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
12839  * for I in range(nSpace):
12840  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
12841  * #
12842  * #accumulate advection and stiffness contributions
12843  */
12844  __pyx_t_41 = __pyx_v_eN;
12845  __pyx_t_42 = __pyx_v_ebN;
12846  __pyx_t_43 = __pyx_v_I;
12847  __pyx_t_37 = -1;
12848  if (__pyx_t_41 < 0) {
12849  __pyx_t_41 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
12850  if (unlikely(__pyx_t_41 < 0)) __pyx_t_37 = 0;
12851  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_37 = 0;
12852  if (__pyx_t_42 < 0) {
12853  __pyx_t_42 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
12854  if (unlikely(__pyx_t_42 < 0)) __pyx_t_37 = 1;
12855  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_37 = 1;
12856  if (__pyx_t_43 < 0) {
12857  __pyx_t_43 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
12858  if (unlikely(__pyx_t_43 < 0)) __pyx_t_37 = 2;
12859  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_37 = 2;
12860  if (unlikely(__pyx_t_37 != -1)) {
12861  __Pyx_RaiseBufferIndexError(__pyx_t_37);
12862  __PYX_ERR(0, 563, __pyx_L1_error)
12863  }
12864  __pyx_t_44 = __pyx_v_eN;
12865  __pyx_t_45 = __pyx_v_ebN;
12866  __pyx_t_37 = -1;
12867  if (__pyx_t_44 < 0) {
12868  __pyx_t_44 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
12869  if (unlikely(__pyx_t_44 < 0)) __pyx_t_37 = 0;
12870  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_37 = 0;
12871  if (__pyx_t_45 < 0) {
12872  __pyx_t_45 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
12873  if (unlikely(__pyx_t_45 < 0)) __pyx_t_37 = 1;
12874  } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_37 = 1;
12875  if (unlikely(__pyx_t_37 != -1)) {
12876  __Pyx_RaiseBufferIndexError(__pyx_t_37);
12877  __PYX_ERR(0, 563, __pyx_L1_error)
12878  }
12879  __pyx_t_46 = __pyx_v_I;
12880  __pyx_t_37 = -1;
12881  if (__pyx_t_46 < 0) {
12882  __pyx_t_46 += __pyx_pybuffernd_f_up.diminfo[0].shape;
12883  if (unlikely(__pyx_t_46 < 0)) __pyx_t_37 = 0;
12884  } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_f_up.diminfo[0].shape)) __pyx_t_37 = 0;
12885  if (unlikely(__pyx_t_37 != -1)) {
12886  __Pyx_RaiseBufferIndexError(__pyx_t_37);
12887  __PYX_ERR(0, 563, __pyx_L1_error)
12888  }
12889  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_f_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_43, __pyx_pybuffernd_q_flin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
12890  }
12891 
12892  /* "subsurfaceTransportFunctions.pyx":566
12893  * #
12894  * #accumulate advection and stiffness contributions
12895  * for I in range(nSpace): # <<<<<<<<<<<<<<
12896  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I]
12897  * for ii in range(rowptr[I],rowptr[I+1]):
12898  */
12899  __pyx_t_31 = __pyx_v_nSpace;
12900  __pyx_t_32 = __pyx_t_31;
12901  for (__pyx_t_33 = 0; __pyx_t_33 < __pyx_t_32; __pyx_t_33+=1) {
12902  __pyx_v_I = __pyx_t_33;
12903 
12904  /* "subsurfaceTransportFunctions.pyx":567
12905  * #accumulate advection and stiffness contributions
12906  * for I in range(nSpace):
12907  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I] # <<<<<<<<<<<<<<
12908  * for ii in range(rowptr[I],rowptr[I+1]):
12909  * elementResidual[eN,i] += weight*a_up[ii]*q_grad_u[eN,ebN,colind[ii]]*q_grad_w[eN,ebN,i,I]
12910  */
12911  __pyx_t_47 = __pyx_v_I;
12912  __pyx_t_37 = -1;
12913  if (__pyx_t_47 < 0) {
12914  __pyx_t_47 += __pyx_pybuffernd_f_up.diminfo[0].shape;
12915  if (unlikely(__pyx_t_47 < 0)) __pyx_t_37 = 0;
12916  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_f_up.diminfo[0].shape)) __pyx_t_37 = 0;
12917  if (unlikely(__pyx_t_37 != -1)) {
12918  __Pyx_RaiseBufferIndexError(__pyx_t_37);
12919  __PYX_ERR(0, 567, __pyx_L1_error)
12920  }
12921  __pyx_t_48 = __pyx_v_eN;
12922  __pyx_t_49 = __pyx_v_ebN;
12923  __pyx_t_50 = __pyx_v_i;
12924  __pyx_t_51 = __pyx_v_I;
12925  __pyx_t_37 = -1;
12926  if (__pyx_t_48 < 0) {
12927  __pyx_t_48 += __pyx_pybuffernd_q_grad_w.diminfo[0].shape;
12928  if (unlikely(__pyx_t_48 < 0)) __pyx_t_37 = 0;
12929  } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_q_grad_w.diminfo[0].shape)) __pyx_t_37 = 0;
12930  if (__pyx_t_49 < 0) {
12931  __pyx_t_49 += __pyx_pybuffernd_q_grad_w.diminfo[1].shape;
12932  if (unlikely(__pyx_t_49 < 0)) __pyx_t_37 = 1;
12933  } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_q_grad_w.diminfo[1].shape)) __pyx_t_37 = 1;
12934  if (__pyx_t_50 < 0) {
12935  __pyx_t_50 += __pyx_pybuffernd_q_grad_w.diminfo[2].shape;
12936  if (unlikely(__pyx_t_50 < 0)) __pyx_t_37 = 2;
12937  } else if (unlikely(__pyx_t_50 >= __pyx_pybuffernd_q_grad_w.diminfo[2].shape)) __pyx_t_37 = 2;
12938  if (__pyx_t_51 < 0) {
12939  __pyx_t_51 += __pyx_pybuffernd_q_grad_w.diminfo[3].shape;
12940  if (unlikely(__pyx_t_51 < 0)) __pyx_t_37 = 3;
12941  } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_q_grad_w.diminfo[3].shape)) __pyx_t_37 = 3;
12942  if (unlikely(__pyx_t_37 != -1)) {
12943  __Pyx_RaiseBufferIndexError(__pyx_t_37);
12944  __PYX_ERR(0, 567, __pyx_L1_error)
12945  }
12946  __pyx_t_52 = __pyx_v_eN;
12947  __pyx_t_53 = __pyx_v_i;
12948  __pyx_t_37 = -1;
12949  if (__pyx_t_52 < 0) {
12950  __pyx_t_52 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
12951  if (unlikely(__pyx_t_52 < 0)) __pyx_t_37 = 0;
12952  } else if (unlikely(__pyx_t_52 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_37 = 0;
12953  if (__pyx_t_53 < 0) {
12954  __pyx_t_53 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
12955  if (unlikely(__pyx_t_53 < 0)) __pyx_t_37 = 1;
12956  } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_37 = 1;
12957  if (unlikely(__pyx_t_37 != -1)) {
12958  __Pyx_RaiseBufferIndexError(__pyx_t_37);
12959  __PYX_ERR(0, 567, __pyx_L1_error)
12960  }
12961  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_53, __pyx_pybuffernd_elementResidual.diminfo[1].strides) -= ((__pyx_v_weight * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_f_up.diminfo[0].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_q_grad_w.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_q_grad_w.diminfo[1].strides, __pyx_t_50, __pyx_pybuffernd_q_grad_w.diminfo[2].strides, __pyx_t_51, __pyx_pybuffernd_q_grad_w.diminfo[3].strides)));
12962 
12963  /* "subsurfaceTransportFunctions.pyx":568
12964  * for I in range(nSpace):
12965  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I]
12966  * for ii in range(rowptr[I],rowptr[I+1]): # <<<<<<<<<<<<<<
12967  * elementResidual[eN,i] += weight*a_up[ii]*q_grad_u[eN,ebN,colind[ii]]*q_grad_w[eN,ebN,i,I]
12968  * #I
12969  */
12970  __pyx_t_54 = (__pyx_v_I + 1);
12971  __pyx_t_37 = -1;
12972  if (__pyx_t_54 < 0) {
12973  __pyx_t_54 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
12974  if (unlikely(__pyx_t_54 < 0)) __pyx_t_37 = 0;
12975  } else if (unlikely(__pyx_t_54 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_37 = 0;
12976  if (unlikely(__pyx_t_37 != -1)) {
12977  __Pyx_RaiseBufferIndexError(__pyx_t_37);
12978  __PYX_ERR(0, 568, __pyx_L1_error)
12979  }
12980  __pyx_t_55 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_rowptr.diminfo[0].strides));
12981  __pyx_t_56 = __pyx_v_I;
12982  __pyx_t_37 = -1;
12983  if (__pyx_t_56 < 0) {
12984  __pyx_t_56 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
12985  if (unlikely(__pyx_t_56 < 0)) __pyx_t_37 = 0;
12986  } else if (unlikely(__pyx_t_56 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_37 = 0;
12987  if (unlikely(__pyx_t_37 != -1)) {
12988  __Pyx_RaiseBufferIndexError(__pyx_t_37);
12989  __PYX_ERR(0, 568, __pyx_L1_error)
12990  }
12991  __pyx_t_57 = __pyx_t_55;
12992  for (__pyx_t_37 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_rowptr.diminfo[0].strides)); __pyx_t_37 < __pyx_t_57; __pyx_t_37+=1) {
12993  __pyx_v_ii = __pyx_t_37;
12994 
12995  /* "subsurfaceTransportFunctions.pyx":569
12996  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I]
12997  * for ii in range(rowptr[I],rowptr[I+1]):
12998  * elementResidual[eN,i] += weight*a_up[ii]*q_grad_u[eN,ebN,colind[ii]]*q_grad_w[eN,ebN,i,I] # <<<<<<<<<<<<<<
12999  * #I
13000  * #j
13001  */
13002  __pyx_t_58 = __pyx_v_ii;
13003  __pyx_t_59 = -1;
13004  if (__pyx_t_58 < 0) {
13005  __pyx_t_58 += __pyx_pybuffernd_a_up.diminfo[0].shape;
13006  if (unlikely(__pyx_t_58 < 0)) __pyx_t_59 = 0;
13007  } else if (unlikely(__pyx_t_58 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_59 = 0;
13008  if (unlikely(__pyx_t_59 != -1)) {
13009  __Pyx_RaiseBufferIndexError(__pyx_t_59);
13010  __PYX_ERR(0, 569, __pyx_L1_error)
13011  }
13012  __pyx_t_60 = __pyx_v_ii;
13013  __pyx_t_59 = -1;
13014  if (__pyx_t_60 < 0) {
13015  __pyx_t_60 += __pyx_pybuffernd_colind.diminfo[0].shape;
13016  if (unlikely(__pyx_t_60 < 0)) __pyx_t_59 = 0;
13017  } else if (unlikely(__pyx_t_60 >= __pyx_pybuffernd_colind.diminfo[0].shape)) __pyx_t_59 = 0;
13018  if (unlikely(__pyx_t_59 != -1)) {
13019  __Pyx_RaiseBufferIndexError(__pyx_t_59);
13020  __PYX_ERR(0, 569, __pyx_L1_error)
13021  }
13022  __pyx_t_61 = __pyx_v_eN;
13023  __pyx_t_62 = __pyx_v_ebN;
13024  __pyx_t_63 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_colind.rcbuffer->pybuffer.buf, __pyx_t_60, __pyx_pybuffernd_colind.diminfo[0].strides));
13025  __pyx_t_59 = -1;
13026  if (__pyx_t_61 < 0) {
13027  __pyx_t_61 += __pyx_pybuffernd_q_grad_u.diminfo[0].shape;
13028  if (unlikely(__pyx_t_61 < 0)) __pyx_t_59 = 0;
13029  } else if (unlikely(__pyx_t_61 >= __pyx_pybuffernd_q_grad_u.diminfo[0].shape)) __pyx_t_59 = 0;
13030  if (__pyx_t_62 < 0) {
13031  __pyx_t_62 += __pyx_pybuffernd_q_grad_u.diminfo[1].shape;
13032  if (unlikely(__pyx_t_62 < 0)) __pyx_t_59 = 1;
13033  } else if (unlikely(__pyx_t_62 >= __pyx_pybuffernd_q_grad_u.diminfo[1].shape)) __pyx_t_59 = 1;
13034  if (__pyx_t_63 < 0) {
13035  __pyx_t_63 += __pyx_pybuffernd_q_grad_u.diminfo[2].shape;
13036  if (unlikely(__pyx_t_63 < 0)) __pyx_t_59 = 2;
13037  } else if (unlikely(__pyx_t_63 >= __pyx_pybuffernd_q_grad_u.diminfo[2].shape)) __pyx_t_59 = 2;
13038  if (unlikely(__pyx_t_59 != -1)) {
13039  __Pyx_RaiseBufferIndexError(__pyx_t_59);
13040  __PYX_ERR(0, 569, __pyx_L1_error)
13041  }
13042  __pyx_t_64 = __pyx_v_eN;
13043  __pyx_t_65 = __pyx_v_ebN;
13044  __pyx_t_66 = __pyx_v_i;
13045  __pyx_t_67 = __pyx_v_I;
13046  __pyx_t_59 = -1;
13047  if (__pyx_t_64 < 0) {
13048  __pyx_t_64 += __pyx_pybuffernd_q_grad_w.diminfo[0].shape;
13049  if (unlikely(__pyx_t_64 < 0)) __pyx_t_59 = 0;
13050  } else if (unlikely(__pyx_t_64 >= __pyx_pybuffernd_q_grad_w.diminfo[0].shape)) __pyx_t_59 = 0;
13051  if (__pyx_t_65 < 0) {
13052  __pyx_t_65 += __pyx_pybuffernd_q_grad_w.diminfo[1].shape;
13053  if (unlikely(__pyx_t_65 < 0)) __pyx_t_59 = 1;
13054  } else if (unlikely(__pyx_t_65 >= __pyx_pybuffernd_q_grad_w.diminfo[1].shape)) __pyx_t_59 = 1;
13055  if (__pyx_t_66 < 0) {
13056  __pyx_t_66 += __pyx_pybuffernd_q_grad_w.diminfo[2].shape;
13057  if (unlikely(__pyx_t_66 < 0)) __pyx_t_59 = 2;
13058  } else if (unlikely(__pyx_t_66 >= __pyx_pybuffernd_q_grad_w.diminfo[2].shape)) __pyx_t_59 = 2;
13059  if (__pyx_t_67 < 0) {
13060  __pyx_t_67 += __pyx_pybuffernd_q_grad_w.diminfo[3].shape;
13061  if (unlikely(__pyx_t_67 < 0)) __pyx_t_59 = 3;
13062  } else if (unlikely(__pyx_t_67 >= __pyx_pybuffernd_q_grad_w.diminfo[3].shape)) __pyx_t_59 = 3;
13063  if (unlikely(__pyx_t_59 != -1)) {
13064  __Pyx_RaiseBufferIndexError(__pyx_t_59);
13065  __PYX_ERR(0, 569, __pyx_L1_error)
13066  }
13067  __pyx_t_68 = __pyx_v_eN;
13068  __pyx_t_69 = __pyx_v_i;
13069  __pyx_t_59 = -1;
13070  if (__pyx_t_68 < 0) {
13071  __pyx_t_68 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
13072  if (unlikely(__pyx_t_68 < 0)) __pyx_t_59 = 0;
13073  } else if (unlikely(__pyx_t_68 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_59 = 0;
13074  if (__pyx_t_69 < 0) {
13075  __pyx_t_69 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
13076  if (unlikely(__pyx_t_69 < 0)) __pyx_t_59 = 1;
13077  } else if (unlikely(__pyx_t_69 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_59 = 1;
13078  if (unlikely(__pyx_t_59 != -1)) {
13079  __Pyx_RaiseBufferIndexError(__pyx_t_59);
13080  __PYX_ERR(0, 569, __pyx_L1_error)
13081  }
13082  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_68, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_69, __pyx_pybuffernd_elementResidual.diminfo[1].strides) += (((__pyx_v_weight * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_a_up.diminfo[0].strides))) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.buf, __pyx_t_61, __pyx_pybuffernd_q_grad_u.diminfo[0].strides, __pyx_t_62, __pyx_pybuffernd_q_grad_u.diminfo[1].strides, __pyx_t_63, __pyx_pybuffernd_q_grad_u.diminfo[2].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.buf, __pyx_t_64, __pyx_pybuffernd_q_grad_w.diminfo[0].strides, __pyx_t_65, __pyx_pybuffernd_q_grad_w.diminfo[1].strides, __pyx_t_66, __pyx_pybuffernd_q_grad_w.diminfo[2].strides, __pyx_t_67, __pyx_pybuffernd_q_grad_w.diminfo[3].strides)));
13083  }
13084  }
13085  }
13086  }
13087  }
13088 
13089  /* "subsurfaceTransportFunctions.pyx":486
13090  * #eN for upwind
13091  *
13092  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
13093  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
13094  * numpy.ndarray[ITYPE_t,ndim=1] colind,
13095  */
13096 
13097  /* function exit code */
13098  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13099  goto __pyx_L0;
13100  __pyx_L1_error:;
13101  __Pyx_XDECREF(__pyx_t_1);
13102  __Pyx_XDECREF(__pyx_t_2);
13103  __Pyx_XDECREF(__pyx_t_4);
13104  __Pyx_XDECREF(__pyx_t_5);
13105  __Pyx_XDECREF(__pyx_t_9);
13106  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
13107  __Pyx_PyThreadState_declare
13108  __Pyx_PyThreadState_assign
13109  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
13110  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
13111  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
13112  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
13113  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
13114  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementResidual.rcbuffer->pybuffer);
13115  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
13116  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
13117  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
13118  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
13119  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
13120  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
13121  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
13122  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
13123  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
13124  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
13125  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
13126  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
13127  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
13128  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
13129  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
13130  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementResidual", __pyx_clineno, __pyx_lineno, __pyx_filename);
13131  __pyx_r = NULL;
13132  goto __pyx_L2;
13133  __pyx_L0:;
13134  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
13135  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
13136  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
13137  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
13138  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementResidual.rcbuffer->pybuffer);
13139  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
13140  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
13141  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
13142  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
13143  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
13144  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
13145  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
13146  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
13147  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
13148  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
13149  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
13150  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
13151  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
13152  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
13153  __pyx_L2:;
13154  __Pyx_XDECREF(__pyx_v_q);
13155  __Pyx_XDECREF((PyObject *)__pyx_v_a_up);
13156  __Pyx_XDECREF((PyObject *)__pyx_v_f_up);
13157  __Pyx_XGIVEREF(__pyx_r);
13158  __Pyx_RefNannyFinishContext();
13159  return __pyx_r;
13160 }
13161 
13162 /* "subsurfaceTransportFunctions.pyx":574
13163  * #i
13164  * #eN
13165  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
13166  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
13167  * numpy.ndarray[ITYPE_t,ndim=1] colind,
13168  */
13169 
13170 /* Python wrapper */
13171 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
13172 static char __pyx_doc_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian[] = "\n residual routine for NCP1 approximation for conservative head formulation of Richards equation \n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n upwinds relative permeability based on element averages\n applies dirichlet boundary conditions strongly but keeps dofs in system\n\n TODO:\n everything\n \n ";
13173 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian = {"RE_NCP1_getElementJacobian", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian};
13174 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
13175  CYTHON_UNUSED PyArrayObject *__pyx_v_gravity = 0;
13176  PyArrayObject *__pyx_v_rowptr = 0;
13177  PyArrayObject *__pyx_v_colind = 0;
13178  int __pyx_v_nSpace;
13179  int __pyx_v_nElements_global;
13180  int __pyx_v_nElementBoundaries_element;
13181  CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray = 0;
13182  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray = 0;
13183  int __pyx_v_nDOF_test_element;
13184  int __pyx_v_nDOF_trial_element;
13185  PyArrayObject *__pyx_v_q_u = 0;
13186  CYTHON_UNUSED PyArrayObject *__pyx_v_q_grad_u = 0;
13187  PyArrayObject *__pyx_v_q_grad_w = 0;
13188  PyArrayObject *__pyx_v_q_grad_v = 0;
13189  PyArrayObject *__pyx_v_q_detJ = 0;
13190  PyArrayObject *__pyx_v_q_m = 0;
13191  CYTHON_UNUSED PyArrayObject *__pyx_v_q_dm = 0;
13192  PyArrayObject *__pyx_v_q_mt = 0;
13193  PyArrayObject *__pyx_v_q_dmt = 0;
13194  PyArrayObject *__pyx_v_q_r = 0;
13195  PyArrayObject *__pyx_v_q_kr = 0;
13196  CYTHON_UNUSED PyArrayObject *__pyx_v_q_dkr = 0;
13197  PyArrayObject *__pyx_v_q_kr_up = 0;
13198  PyArrayObject *__pyx_v_q_flin = 0;
13199  PyArrayObject *__pyx_v_q_alin = 0;
13200  PyArrayObject *__pyx_v_elementJacobian = 0;
13201  PyObject *__pyx_r = 0;
13202  __Pyx_RefNannyDeclarations
13203  __Pyx_RefNannySetupContext("RE_NCP1_getElementJacobian (wrapper)", 0);
13204  {
13205  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gravity,&__pyx_n_s_rowptr,&__pyx_n_s_colind,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_nDOF_test_element,&__pyx_n_s_nDOF_trial_element,&__pyx_n_s_q_u,&__pyx_n_s_q_grad_u,&__pyx_n_s_q_grad_w,&__pyx_n_s_q_grad_v,&__pyx_n_s_q_detJ,&__pyx_n_s_q_m,&__pyx_n_s_q_dm,&__pyx_n_s_q_mt,&__pyx_n_s_q_dmt,&__pyx_n_s_q_r,&__pyx_n_s_q_kr,&__pyx_n_s_q_dkr,&__pyx_n_s_q_kr_up,&__pyx_n_s_q_flin,&__pyx_n_s_q_alin,&__pyx_n_s_elementJacobian,0};
13206  PyObject* values[26] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
13207  if (unlikely(__pyx_kwds)) {
13208  Py_ssize_t kw_args;
13209  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
13210  switch (pos_args) {
13211  case 26: values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
13212  CYTHON_FALLTHROUGH;
13213  case 25: values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
13214  CYTHON_FALLTHROUGH;
13215  case 24: values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
13216  CYTHON_FALLTHROUGH;
13217  case 23: values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
13218  CYTHON_FALLTHROUGH;
13219  case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
13220  CYTHON_FALLTHROUGH;
13221  case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
13222  CYTHON_FALLTHROUGH;
13223  case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
13224  CYTHON_FALLTHROUGH;
13225  case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
13226  CYTHON_FALLTHROUGH;
13227  case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
13228  CYTHON_FALLTHROUGH;
13229  case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
13230  CYTHON_FALLTHROUGH;
13231  case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
13232  CYTHON_FALLTHROUGH;
13233  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
13234  CYTHON_FALLTHROUGH;
13235  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
13236  CYTHON_FALLTHROUGH;
13237  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
13238  CYTHON_FALLTHROUGH;
13239  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
13240  CYTHON_FALLTHROUGH;
13241  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
13242  CYTHON_FALLTHROUGH;
13243  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
13244  CYTHON_FALLTHROUGH;
13245  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
13246  CYTHON_FALLTHROUGH;
13247  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
13248  CYTHON_FALLTHROUGH;
13249  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
13250  CYTHON_FALLTHROUGH;
13251  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
13252  CYTHON_FALLTHROUGH;
13253  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
13254  CYTHON_FALLTHROUGH;
13255  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
13256  CYTHON_FALLTHROUGH;
13257  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13258  CYTHON_FALLTHROUGH;
13259  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13260  CYTHON_FALLTHROUGH;
13261  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13262  CYTHON_FALLTHROUGH;
13263  case 0: break;
13264  default: goto __pyx_L5_argtuple_error;
13265  }
13266  kw_args = PyDict_Size(__pyx_kwds);
13267  switch (pos_args) {
13268  case 0:
13269  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
13270  else goto __pyx_L5_argtuple_error;
13271  CYTHON_FALLTHROUGH;
13272  case 1:
13273  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
13274  else {
13275  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 1); __PYX_ERR(0, 574, __pyx_L3_error)
13276  }
13277  CYTHON_FALLTHROUGH;
13278  case 2:
13279  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
13280  else {
13281  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 2); __PYX_ERR(0, 574, __pyx_L3_error)
13282  }
13283  CYTHON_FALLTHROUGH;
13284  case 3:
13285  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
13286  else {
13287  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 3); __PYX_ERR(0, 574, __pyx_L3_error)
13288  }
13289  CYTHON_FALLTHROUGH;
13290  case 4:
13291  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
13292  else {
13293  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 4); __PYX_ERR(0, 574, __pyx_L3_error)
13294  }
13295  CYTHON_FALLTHROUGH;
13296  case 5:
13297  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
13298  else {
13299  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 5); __PYX_ERR(0, 574, __pyx_L3_error)
13300  }
13301  CYTHON_FALLTHROUGH;
13302  case 6:
13303  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
13304  else {
13305  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 6); __PYX_ERR(0, 574, __pyx_L3_error)
13306  }
13307  CYTHON_FALLTHROUGH;
13308  case 7:
13309  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
13310  else {
13311  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 7); __PYX_ERR(0, 574, __pyx_L3_error)
13312  }
13313  CYTHON_FALLTHROUGH;
13314  case 8:
13315  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nDOF_test_element)) != 0)) kw_args--;
13316  else {
13317  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 8); __PYX_ERR(0, 574, __pyx_L3_error)
13318  }
13319  CYTHON_FALLTHROUGH;
13320  case 9:
13321  if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nDOF_trial_element)) != 0)) kw_args--;
13322  else {
13323  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 9); __PYX_ERR(0, 574, __pyx_L3_error)
13324  }
13325  CYTHON_FALLTHROUGH;
13326  case 10:
13327  if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_u)) != 0)) kw_args--;
13328  else {
13329  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 10); __PYX_ERR(0, 574, __pyx_L3_error)
13330  }
13331  CYTHON_FALLTHROUGH;
13332  case 11:
13333  if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_grad_u)) != 0)) kw_args--;
13334  else {
13335  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 11); __PYX_ERR(0, 574, __pyx_L3_error)
13336  }
13337  CYTHON_FALLTHROUGH;
13338  case 12:
13339  if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_grad_w)) != 0)) kw_args--;
13340  else {
13341  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 12); __PYX_ERR(0, 574, __pyx_L3_error)
13342  }
13343  CYTHON_FALLTHROUGH;
13344  case 13:
13345  if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_grad_v)) != 0)) kw_args--;
13346  else {
13347  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 13); __PYX_ERR(0, 574, __pyx_L3_error)
13348  }
13349  CYTHON_FALLTHROUGH;
13350  case 14:
13351  if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_detJ)) != 0)) kw_args--;
13352  else {
13353  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 14); __PYX_ERR(0, 574, __pyx_L3_error)
13354  }
13355  CYTHON_FALLTHROUGH;
13356  case 15:
13357  if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_m)) != 0)) kw_args--;
13358  else {
13359  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 15); __PYX_ERR(0, 574, __pyx_L3_error)
13360  }
13361  CYTHON_FALLTHROUGH;
13362  case 16:
13363  if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_dm)) != 0)) kw_args--;
13364  else {
13365  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 16); __PYX_ERR(0, 574, __pyx_L3_error)
13366  }
13367  CYTHON_FALLTHROUGH;
13368  case 17:
13369  if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_mt)) != 0)) kw_args--;
13370  else {
13371  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 17); __PYX_ERR(0, 574, __pyx_L3_error)
13372  }
13373  CYTHON_FALLTHROUGH;
13374  case 18:
13375  if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_dmt)) != 0)) kw_args--;
13376  else {
13377  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 18); __PYX_ERR(0, 574, __pyx_L3_error)
13378  }
13379  CYTHON_FALLTHROUGH;
13380  case 19:
13381  if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_r)) != 0)) kw_args--;
13382  else {
13383  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 19); __PYX_ERR(0, 574, __pyx_L3_error)
13384  }
13385  CYTHON_FALLTHROUGH;
13386  case 20:
13387  if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr)) != 0)) kw_args--;
13388  else {
13389  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 20); __PYX_ERR(0, 574, __pyx_L3_error)
13390  }
13391  CYTHON_FALLTHROUGH;
13392  case 21:
13393  if (likely((values[21] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_dkr)) != 0)) kw_args--;
13394  else {
13395  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 21); __PYX_ERR(0, 574, __pyx_L3_error)
13396  }
13397  CYTHON_FALLTHROUGH;
13398  case 22:
13399  if (likely((values[22] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr_up)) != 0)) kw_args--;
13400  else {
13401  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 22); __PYX_ERR(0, 574, __pyx_L3_error)
13402  }
13403  CYTHON_FALLTHROUGH;
13404  case 23:
13405  if (likely((values[23] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_flin)) != 0)) kw_args--;
13406  else {
13407  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 23); __PYX_ERR(0, 574, __pyx_L3_error)
13408  }
13409  CYTHON_FALLTHROUGH;
13410  case 24:
13411  if (likely((values[24] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_alin)) != 0)) kw_args--;
13412  else {
13413  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 24); __PYX_ERR(0, 574, __pyx_L3_error)
13414  }
13415  CYTHON_FALLTHROUGH;
13416  case 25:
13417  if (likely((values[25] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementJacobian)) != 0)) kw_args--;
13418  else {
13419  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 25); __PYX_ERR(0, 574, __pyx_L3_error)
13420  }
13421  }
13422  if (unlikely(kw_args > 0)) {
13423  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_getElementJacobian") < 0)) __PYX_ERR(0, 574, __pyx_L3_error)
13424  }
13425  } else if (PyTuple_GET_SIZE(__pyx_args) != 26) {
13426  goto __pyx_L5_argtuple_error;
13427  } else {
13428  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13429  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13430  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13431  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
13432  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
13433  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
13434  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
13435  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
13436  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
13437  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
13438  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
13439  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
13440  values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
13441  values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
13442  values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
13443  values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
13444  values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
13445  values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
13446  values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
13447  values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
13448  values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
13449  values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
13450  values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
13451  values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
13452  values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
13453  values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
13454  }
13455  __pyx_v_gravity = ((PyArrayObject *)values[0]);
13456  __pyx_v_rowptr = ((PyArrayObject *)values[1]);
13457  __pyx_v_colind = ((PyArrayObject *)values[2]);
13458  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 578, __pyx_L3_error)
13459  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 579, __pyx_L3_error)
13460  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 580, __pyx_L3_error)
13461  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[6]);
13462  __pyx_v_elementBarycentersArray = ((PyArrayObject *)values[7]);
13463  __pyx_v_nDOF_test_element = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_nDOF_test_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 584, __pyx_L3_error)
13464  __pyx_v_nDOF_trial_element = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_nDOF_trial_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 585, __pyx_L3_error)
13465  __pyx_v_q_u = ((PyArrayObject *)values[10]);
13466  __pyx_v_q_grad_u = ((PyArrayObject *)values[11]);
13467  __pyx_v_q_grad_w = ((PyArrayObject *)values[12]);
13468  __pyx_v_q_grad_v = ((PyArrayObject *)values[13]);
13469  __pyx_v_q_detJ = ((PyArrayObject *)values[14]);
13470  __pyx_v_q_m = ((PyArrayObject *)values[15]);
13471  __pyx_v_q_dm = ((PyArrayObject *)values[16]);
13472  __pyx_v_q_mt = ((PyArrayObject *)values[17]);
13473  __pyx_v_q_dmt = ((PyArrayObject *)values[18]);
13474  __pyx_v_q_r = ((PyArrayObject *)values[19]);
13475  __pyx_v_q_kr = ((PyArrayObject *)values[20]);
13476  __pyx_v_q_dkr = ((PyArrayObject *)values[21]);
13477  __pyx_v_q_kr_up = ((PyArrayObject *)values[22]);
13478  __pyx_v_q_flin = ((PyArrayObject *)values[23]);
13479  __pyx_v_q_alin = ((PyArrayObject *)values[24]);
13480  __pyx_v_elementJacobian = ((PyArrayObject *)values[25]);
13481  }
13482  goto __pyx_L4_argument_unpacking_done;
13483  __pyx_L5_argtuple_error:;
13484  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 574, __pyx_L3_error)
13485  __pyx_L3_error:;
13486  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
13487  __Pyx_RefNannyFinishContext();
13488  return NULL;
13489  __pyx_L4_argument_unpacking_done:;
13490  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) __PYX_ERR(0, 574, __pyx_L1_error)
13491  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rowptr), __pyx_ptype_5numpy_ndarray, 1, "rowptr", 0))) __PYX_ERR(0, 575, __pyx_L1_error)
13492  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_colind), __pyx_ptype_5numpy_ndarray, 1, "colind", 0))) __PYX_ERR(0, 576, __pyx_L1_error)
13493  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) __PYX_ERR(0, 581, __pyx_L1_error)
13494  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_ptype_5numpy_ndarray, 1, "elementBarycentersArray", 0))) __PYX_ERR(0, 582, __pyx_L1_error)
13495  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_u), __pyx_ptype_5numpy_ndarray, 1, "q_u", 0))) __PYX_ERR(0, 586, __pyx_L1_error)
13496  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_u), __pyx_ptype_5numpy_ndarray, 1, "q_grad_u", 0))) __PYX_ERR(0, 587, __pyx_L1_error)
13497  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_w), __pyx_ptype_5numpy_ndarray, 1, "q_grad_w", 0))) __PYX_ERR(0, 588, __pyx_L1_error)
13498  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_v), __pyx_ptype_5numpy_ndarray, 1, "q_grad_v", 0))) __PYX_ERR(0, 589, __pyx_L1_error)
13499  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_detJ), __pyx_ptype_5numpy_ndarray, 1, "q_detJ", 0))) __PYX_ERR(0, 591, __pyx_L1_error)
13500  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_m), __pyx_ptype_5numpy_ndarray, 1, "q_m", 0))) __PYX_ERR(0, 592, __pyx_L1_error)
13501  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dm), __pyx_ptype_5numpy_ndarray, 1, "q_dm", 0))) __PYX_ERR(0, 593, __pyx_L1_error)
13502  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_mt), __pyx_ptype_5numpy_ndarray, 1, "q_mt", 0))) __PYX_ERR(0, 594, __pyx_L1_error)
13503  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dmt), __pyx_ptype_5numpy_ndarray, 1, "q_dmt", 0))) __PYX_ERR(0, 595, __pyx_L1_error)
13504  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_r), __pyx_ptype_5numpy_ndarray, 1, "q_r", 0))) __PYX_ERR(0, 596, __pyx_L1_error)
13505  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr), __pyx_ptype_5numpy_ndarray, 1, "q_kr", 0))) __PYX_ERR(0, 597, __pyx_L1_error)
13506  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dkr), __pyx_ptype_5numpy_ndarray, 1, "q_dkr", 0))) __PYX_ERR(0, 598, __pyx_L1_error)
13507  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr_up), __pyx_ptype_5numpy_ndarray, 1, "q_kr_up", 0))) __PYX_ERR(0, 599, __pyx_L1_error)
13508  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_flin), __pyx_ptype_5numpy_ndarray, 1, "q_flin", 0))) __PYX_ERR(0, 602, __pyx_L1_error)
13509  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_alin), __pyx_ptype_5numpy_ndarray, 1, "q_alin", 0))) __PYX_ERR(0, 603, __pyx_L1_error)
13510  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementJacobian), __pyx_ptype_5numpy_ndarray, 1, "elementJacobian", 0))) __PYX_ERR(0, 605, __pyx_L1_error)
13511  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian(__pyx_self, __pyx_v_gravity, __pyx_v_rowptr, __pyx_v_colind, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementBarycentersArray, __pyx_v_nDOF_test_element, __pyx_v_nDOF_trial_element, __pyx_v_q_u, __pyx_v_q_grad_u, __pyx_v_q_grad_w, __pyx_v_q_grad_v, __pyx_v_q_detJ, __pyx_v_q_m, __pyx_v_q_dm, __pyx_v_q_mt, __pyx_v_q_dmt, __pyx_v_q_r, __pyx_v_q_kr, __pyx_v_q_dkr, __pyx_v_q_kr_up, __pyx_v_q_flin, __pyx_v_q_alin, __pyx_v_elementJacobian);
13512 
13513  /* function exit code */
13514  goto __pyx_L0;
13515  __pyx_L1_error:;
13516  __pyx_r = NULL;
13517  __pyx_L0:;
13518  __Pyx_RefNannyFinishContext();
13519  return __pyx_r;
13520 }
13521 
13522 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_q_u, CYTHON_UNUSED PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_grad_v, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dm, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_dmt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementJacobian) {
13523  CYTHON_UNUSED int __pyx_v_upwindFlag;
13524  CYTHON_UNUSED int __pyx_v_picard;
13525  PyObject *__pyx_v_q = NULL;
13526  int __pyx_v_nnz;
13527  int __pyx_v_eN;
13528  int __pyx_v_ii;
13529  int __pyx_v_I;
13530  PyArrayObject *__pyx_v_a_up = 0;
13531  PyArrayObject *__pyx_v_f_up = 0;
13532  double __pyx_v_nAvgWeight;
13533  double __pyx_v_weight;
13534  double __pyx_v_volFactor;
13535  CYTHON_UNUSED int __pyx_v_thisElementIsUpwind;
13536  double __pyx_v_volume;
13537  int __pyx_v_i;
13538  int __pyx_v_ebN;
13539  int __pyx_v_j;
13540  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_up;
13541  __Pyx_Buffer __pyx_pybuffer_a_up;
13542  __Pyx_LocalBuf_ND __pyx_pybuffernd_colind;
13543  __Pyx_Buffer __pyx_pybuffer_colind;
13544  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBarycentersArray;
13545  __Pyx_Buffer __pyx_pybuffer_elementBarycentersArray;
13546  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementJacobian;
13547  __Pyx_Buffer __pyx_pybuffer_elementJacobian;
13548  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
13549  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
13550  __Pyx_LocalBuf_ND __pyx_pybuffernd_f_up;
13551  __Pyx_Buffer __pyx_pybuffer_f_up;
13552  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
13553  __Pyx_Buffer __pyx_pybuffer_gravity;
13554  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_alin;
13555  __Pyx_Buffer __pyx_pybuffer_q_alin;
13556  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_detJ;
13557  __Pyx_Buffer __pyx_pybuffer_q_detJ;
13558  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dkr;
13559  __Pyx_Buffer __pyx_pybuffer_q_dkr;
13560  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dm;
13561  __Pyx_Buffer __pyx_pybuffer_q_dm;
13562  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dmt;
13563  __Pyx_Buffer __pyx_pybuffer_q_dmt;
13564  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_flin;
13565  __Pyx_Buffer __pyx_pybuffer_q_flin;
13566  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_u;
13567  __Pyx_Buffer __pyx_pybuffer_q_grad_u;
13568  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_v;
13569  __Pyx_Buffer __pyx_pybuffer_q_grad_v;
13570  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_w;
13571  __Pyx_Buffer __pyx_pybuffer_q_grad_w;
13572  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr;
13573  __Pyx_Buffer __pyx_pybuffer_q_kr;
13574  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr_up;
13575  __Pyx_Buffer __pyx_pybuffer_q_kr_up;
13576  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_m;
13577  __Pyx_Buffer __pyx_pybuffer_q_m;
13578  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_mt;
13579  __Pyx_Buffer __pyx_pybuffer_q_mt;
13580  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_r;
13581  __Pyx_Buffer __pyx_pybuffer_q_r;
13582  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_u;
13583  __Pyx_Buffer __pyx_pybuffer_q_u;
13584  __Pyx_LocalBuf_ND __pyx_pybuffernd_rowptr;
13585  __Pyx_Buffer __pyx_pybuffer_rowptr;
13586  PyObject *__pyx_r = NULL;
13587  __Pyx_RefNannyDeclarations
13588  PyObject *__pyx_t_1 = NULL;
13589  PyObject *__pyx_t_2 = NULL;
13590  Py_ssize_t __pyx_t_3;
13591  PyObject *__pyx_t_4 = NULL;
13592  PyObject *__pyx_t_5 = NULL;
13593  int __pyx_t_6;
13594  Py_ssize_t __pyx_t_7;
13595  int __pyx_t_8;
13596  PyObject *__pyx_t_9 = NULL;
13597  PyArrayObject *__pyx_t_10 = NULL;
13598  PyArrayObject *__pyx_t_11 = NULL;
13599  double __pyx_t_12;
13600  int __pyx_t_13;
13601  int __pyx_t_14;
13602  Py_ssize_t __pyx_t_15;
13603  Py_ssize_t __pyx_t_16;
13604  int __pyx_t_17;
13605  int __pyx_t_18;
13606  int __pyx_t_19;
13607  Py_ssize_t __pyx_t_20;
13608  Py_ssize_t __pyx_t_21;
13609  int __pyx_t_22;
13610  Py_ssize_t __pyx_t_23;
13611  Py_ssize_t __pyx_t_24;
13612  Py_ssize_t __pyx_t_25;
13613  int __pyx_t_26;
13614  int __pyx_t_27;
13615  int __pyx_t_28;
13616  int __pyx_t_29;
13617  int __pyx_t_30;
13618  Py_ssize_t __pyx_t_31;
13619  Py_ssize_t __pyx_t_32;
13620  Py_ssize_t __pyx_t_33;
13621  int __pyx_t_34;
13622  Py_ssize_t __pyx_t_35;
13623  Py_ssize_t __pyx_t_36;
13624  Py_ssize_t __pyx_t_37;
13625  Py_ssize_t __pyx_t_38;
13626  Py_ssize_t __pyx_t_39;
13627  Py_ssize_t __pyx_t_40;
13628  Py_ssize_t __pyx_t_41;
13629  Py_ssize_t __pyx_t_42;
13630  Py_ssize_t __pyx_t_43;
13631  int __pyx_t_44;
13632  int __pyx_t_45;
13633  Py_ssize_t __pyx_t_46;
13634  int __pyx_t_47;
13635  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_48;
13636  Py_ssize_t __pyx_t_49;
13637  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_50;
13638  Py_ssize_t __pyx_t_51;
13639  int __pyx_t_52;
13640  Py_ssize_t __pyx_t_53;
13641  Py_ssize_t __pyx_t_54;
13642  Py_ssize_t __pyx_t_55;
13643  Py_ssize_t __pyx_t_56;
13644  Py_ssize_t __pyx_t_57;
13645  Py_ssize_t __pyx_t_58;
13646  Py_ssize_t __pyx_t_59;
13647  Py_ssize_t __pyx_t_60;
13648  Py_ssize_t __pyx_t_61;
13649  Py_ssize_t __pyx_t_62;
13650  Py_ssize_t __pyx_t_63;
13651  Py_ssize_t __pyx_t_64;
13652  __Pyx_RefNannySetupContext("RE_NCP1_getElementJacobian", 0);
13653  __pyx_pybuffer_a_up.pybuffer.buf = NULL;
13654  __pyx_pybuffer_a_up.refcount = 0;
13655  __pyx_pybuffernd_a_up.data = NULL;
13656  __pyx_pybuffernd_a_up.rcbuffer = &__pyx_pybuffer_a_up;
13657  __pyx_pybuffer_f_up.pybuffer.buf = NULL;
13658  __pyx_pybuffer_f_up.refcount = 0;
13659  __pyx_pybuffernd_f_up.data = NULL;
13660  __pyx_pybuffernd_f_up.rcbuffer = &__pyx_pybuffer_f_up;
13661  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
13662  __pyx_pybuffer_gravity.refcount = 0;
13663  __pyx_pybuffernd_gravity.data = NULL;
13664  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
13665  __pyx_pybuffer_rowptr.pybuffer.buf = NULL;
13666  __pyx_pybuffer_rowptr.refcount = 0;
13667  __pyx_pybuffernd_rowptr.data = NULL;
13668  __pyx_pybuffernd_rowptr.rcbuffer = &__pyx_pybuffer_rowptr;
13669  __pyx_pybuffer_colind.pybuffer.buf = NULL;
13670  __pyx_pybuffer_colind.refcount = 0;
13671  __pyx_pybuffernd_colind.data = NULL;
13672  __pyx_pybuffernd_colind.rcbuffer = &__pyx_pybuffer_colind;
13673  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
13674  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
13675  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
13676  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
13677  __pyx_pybuffer_elementBarycentersArray.pybuffer.buf = NULL;
13678  __pyx_pybuffer_elementBarycentersArray.refcount = 0;
13679  __pyx_pybuffernd_elementBarycentersArray.data = NULL;
13680  __pyx_pybuffernd_elementBarycentersArray.rcbuffer = &__pyx_pybuffer_elementBarycentersArray;
13681  __pyx_pybuffer_q_u.pybuffer.buf = NULL;
13682  __pyx_pybuffer_q_u.refcount = 0;
13683  __pyx_pybuffernd_q_u.data = NULL;
13684  __pyx_pybuffernd_q_u.rcbuffer = &__pyx_pybuffer_q_u;
13685  __pyx_pybuffer_q_grad_u.pybuffer.buf = NULL;
13686  __pyx_pybuffer_q_grad_u.refcount = 0;
13687  __pyx_pybuffernd_q_grad_u.data = NULL;
13688  __pyx_pybuffernd_q_grad_u.rcbuffer = &__pyx_pybuffer_q_grad_u;
13689  __pyx_pybuffer_q_grad_w.pybuffer.buf = NULL;
13690  __pyx_pybuffer_q_grad_w.refcount = 0;
13691  __pyx_pybuffernd_q_grad_w.data = NULL;
13692  __pyx_pybuffernd_q_grad_w.rcbuffer = &__pyx_pybuffer_q_grad_w;
13693  __pyx_pybuffer_q_grad_v.pybuffer.buf = NULL;
13694  __pyx_pybuffer_q_grad_v.refcount = 0;
13695  __pyx_pybuffernd_q_grad_v.data = NULL;
13696  __pyx_pybuffernd_q_grad_v.rcbuffer = &__pyx_pybuffer_q_grad_v;
13697  __pyx_pybuffer_q_detJ.pybuffer.buf = NULL;
13698  __pyx_pybuffer_q_detJ.refcount = 0;
13699  __pyx_pybuffernd_q_detJ.data = NULL;
13700  __pyx_pybuffernd_q_detJ.rcbuffer = &__pyx_pybuffer_q_detJ;
13701  __pyx_pybuffer_q_m.pybuffer.buf = NULL;
13702  __pyx_pybuffer_q_m.refcount = 0;
13703  __pyx_pybuffernd_q_m.data = NULL;
13704  __pyx_pybuffernd_q_m.rcbuffer = &__pyx_pybuffer_q_m;
13705  __pyx_pybuffer_q_dm.pybuffer.buf = NULL;
13706  __pyx_pybuffer_q_dm.refcount = 0;
13707  __pyx_pybuffernd_q_dm.data = NULL;
13708  __pyx_pybuffernd_q_dm.rcbuffer = &__pyx_pybuffer_q_dm;
13709  __pyx_pybuffer_q_mt.pybuffer.buf = NULL;
13710  __pyx_pybuffer_q_mt.refcount = 0;
13711  __pyx_pybuffernd_q_mt.data = NULL;
13712  __pyx_pybuffernd_q_mt.rcbuffer = &__pyx_pybuffer_q_mt;
13713  __pyx_pybuffer_q_dmt.pybuffer.buf = NULL;
13714  __pyx_pybuffer_q_dmt.refcount = 0;
13715  __pyx_pybuffernd_q_dmt.data = NULL;
13716  __pyx_pybuffernd_q_dmt.rcbuffer = &__pyx_pybuffer_q_dmt;
13717  __pyx_pybuffer_q_r.pybuffer.buf = NULL;
13718  __pyx_pybuffer_q_r.refcount = 0;
13719  __pyx_pybuffernd_q_r.data = NULL;
13720  __pyx_pybuffernd_q_r.rcbuffer = &__pyx_pybuffer_q_r;
13721  __pyx_pybuffer_q_kr.pybuffer.buf = NULL;
13722  __pyx_pybuffer_q_kr.refcount = 0;
13723  __pyx_pybuffernd_q_kr.data = NULL;
13724  __pyx_pybuffernd_q_kr.rcbuffer = &__pyx_pybuffer_q_kr;
13725  __pyx_pybuffer_q_dkr.pybuffer.buf = NULL;
13726  __pyx_pybuffer_q_dkr.refcount = 0;
13727  __pyx_pybuffernd_q_dkr.data = NULL;
13728  __pyx_pybuffernd_q_dkr.rcbuffer = &__pyx_pybuffer_q_dkr;
13729  __pyx_pybuffer_q_kr_up.pybuffer.buf = NULL;
13730  __pyx_pybuffer_q_kr_up.refcount = 0;
13731  __pyx_pybuffernd_q_kr_up.data = NULL;
13732  __pyx_pybuffernd_q_kr_up.rcbuffer = &__pyx_pybuffer_q_kr_up;
13733  __pyx_pybuffer_q_flin.pybuffer.buf = NULL;
13734  __pyx_pybuffer_q_flin.refcount = 0;
13735  __pyx_pybuffernd_q_flin.data = NULL;
13736  __pyx_pybuffernd_q_flin.rcbuffer = &__pyx_pybuffer_q_flin;
13737  __pyx_pybuffer_q_alin.pybuffer.buf = NULL;
13738  __pyx_pybuffer_q_alin.refcount = 0;
13739  __pyx_pybuffernd_q_alin.data = NULL;
13740  __pyx_pybuffernd_q_alin.rcbuffer = &__pyx_pybuffer_q_alin;
13741  __pyx_pybuffer_elementJacobian.pybuffer.buf = NULL;
13742  __pyx_pybuffer_elementJacobian.refcount = 0;
13743  __pyx_pybuffernd_elementJacobian.data = NULL;
13744  __pyx_pybuffernd_elementJacobian.rcbuffer = &__pyx_pybuffer_elementJacobian;
13745  {
13746  __Pyx_BufFmt_StackElem __pyx_stack[1];
13747  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13748  }
13749  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
13750  {
13751  __Pyx_BufFmt_StackElem __pyx_stack[1];
13752  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_rowptr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13753  }
13754  __pyx_pybuffernd_rowptr.diminfo[0].strides = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rowptr.diminfo[0].shape = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.shape[0];
13755  {
13756  __Pyx_BufFmt_StackElem __pyx_stack[1];
13757  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_colind.rcbuffer->pybuffer, (PyObject*)__pyx_v_colind, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13758  }
13759  __pyx_pybuffernd_colind.diminfo[0].strides = __pyx_pybuffernd_colind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_colind.diminfo[0].shape = __pyx_pybuffernd_colind.rcbuffer->pybuffer.shape[0];
13760  {
13761  __Pyx_BufFmt_StackElem __pyx_stack[1];
13762  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13763  }
13764  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
13765  {
13766  __Pyx_BufFmt_StackElem __pyx_stack[1];
13767  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBarycentersArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13768  }
13769  __pyx_pybuffernd_elementBarycentersArray.diminfo[0].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[0].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[1];
13770  {
13771  __Pyx_BufFmt_StackElem __pyx_stack[1];
13772  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13773  }
13774  __pyx_pybuffernd_q_u.diminfo[0].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_u.diminfo[0].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_u.diminfo[1].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_u.diminfo[1].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[1];
13775  {
13776  __Pyx_BufFmt_StackElem __pyx_stack[1];
13777  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13778  }
13779  __pyx_pybuffernd_q_grad_u.diminfo[0].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_u.diminfo[0].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_u.diminfo[1].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_u.diminfo[1].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_u.diminfo[2].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_u.diminfo[2].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[2];
13780  {
13781  __Pyx_BufFmt_StackElem __pyx_stack[1];
13782  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13783  }
13784  __pyx_pybuffernd_q_grad_w.diminfo[0].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_w.diminfo[0].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_w.diminfo[1].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_w.diminfo[1].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_w.diminfo[2].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_w.diminfo[2].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_q_grad_w.diminfo[3].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_q_grad_w.diminfo[3].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[3];
13785  {
13786  __Pyx_BufFmt_StackElem __pyx_stack[1];
13787  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13788  }
13789  __pyx_pybuffernd_q_grad_v.diminfo[0].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_v.diminfo[0].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_v.diminfo[1].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_v.diminfo[1].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_v.diminfo[2].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_v.diminfo[2].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_q_grad_v.diminfo[3].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_q_grad_v.diminfo[3].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[3];
13790  {
13791  __Pyx_BufFmt_StackElem __pyx_stack[1];
13792  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_detJ, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13793  }
13794  __pyx_pybuffernd_q_detJ.diminfo[0].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_detJ.diminfo[0].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_detJ.diminfo[1].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_detJ.diminfo[1].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[1];
13795  {
13796  __Pyx_BufFmt_StackElem __pyx_stack[1];
13797  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_m, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13798  }
13799  __pyx_pybuffernd_q_m.diminfo[0].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_m.diminfo[0].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_m.diminfo[1].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_m.diminfo[1].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[1];
13800  {
13801  __Pyx_BufFmt_StackElem __pyx_stack[1];
13802  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dm.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dm, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13803  }
13804  __pyx_pybuffernd_q_dm.diminfo[0].strides = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dm.diminfo[0].shape = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dm.diminfo[1].strides = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dm.diminfo[1].shape = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.shape[1];
13805  {
13806  __Pyx_BufFmt_StackElem __pyx_stack[1];
13807  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_mt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13808  }
13809  __pyx_pybuffernd_q_mt.diminfo[0].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_mt.diminfo[0].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_mt.diminfo[1].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_mt.diminfo[1].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[1];
13810  {
13811  __Pyx_BufFmt_StackElem __pyx_stack[1];
13812  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dmt.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dmt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13813  }
13814  __pyx_pybuffernd_q_dmt.diminfo[0].strides = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dmt.diminfo[0].shape = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dmt.diminfo[1].strides = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dmt.diminfo[1].shape = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.shape[1];
13815  {
13816  __Pyx_BufFmt_StackElem __pyx_stack[1];
13817  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_r, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13818  }
13819  __pyx_pybuffernd_q_r.diminfo[0].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_r.diminfo[0].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_r.diminfo[1].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_r.diminfo[1].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[1];
13820  {
13821  __Pyx_BufFmt_StackElem __pyx_stack[1];
13822  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13823  }
13824  __pyx_pybuffernd_q_kr.diminfo[0].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr.diminfo[0].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr.diminfo[1].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr.diminfo[1].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[1];
13825  {
13826  __Pyx_BufFmt_StackElem __pyx_stack[1];
13827  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dkr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13828  }
13829  __pyx_pybuffernd_q_dkr.diminfo[0].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dkr.diminfo[0].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dkr.diminfo[1].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dkr.diminfo[1].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[1];
13830  {
13831  __Pyx_BufFmt_StackElem __pyx_stack[1];
13832  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr_up, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13833  }
13834  __pyx_pybuffernd_q_kr_up.diminfo[0].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr_up.diminfo[0].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr_up.diminfo[1].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr_up.diminfo[1].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[1];
13835  {
13836  __Pyx_BufFmt_StackElem __pyx_stack[1];
13837  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_flin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13838  }
13839  __pyx_pybuffernd_q_flin.diminfo[0].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_flin.diminfo[0].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_flin.diminfo[1].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_flin.diminfo[1].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_flin.diminfo[2].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_flin.diminfo[2].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[2];
13840  {
13841  __Pyx_BufFmt_StackElem __pyx_stack[1];
13842  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_alin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13843  }
13844  __pyx_pybuffernd_q_alin.diminfo[0].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_alin.diminfo[0].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_alin.diminfo[1].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_alin.diminfo[1].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_alin.diminfo[2].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_alin.diminfo[2].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[2];
13845  {
13846  __Pyx_BufFmt_StackElem __pyx_stack[1];
13847  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementJacobian, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13848  }
13849  __pyx_pybuffernd_elementJacobian.diminfo[0].strides = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementJacobian.diminfo[0].shape = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementJacobian.diminfo[1].strides = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementJacobian.diminfo[1].shape = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_elementJacobian.diminfo[2].strides = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_elementJacobian.diminfo[2].shape = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.shape[2];
13850 
13851  /* "subsurfaceTransportFunctions.pyx":620
13852  *
13853  * """
13854  * cdef int upwindFlag = 1 # <<<<<<<<<<<<<<
13855  * cdef int picard = 1
13856  * #check some sizes
13857  */
13858  __pyx_v_upwindFlag = 1;
13859 
13860  /* "subsurfaceTransportFunctions.pyx":621
13861  * """
13862  * cdef int upwindFlag = 1
13863  * cdef int picard = 1 # <<<<<<<<<<<<<<
13864  * #check some sizes
13865  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
13866  */
13867  __pyx_v_picard = 1;
13868 
13869  /* "subsurfaceTransportFunctions.pyx":623
13870  * cdef int picard = 1
13871  * #check some sizes
13872  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
13873  * assert q.shape[1] == nSpace+1
13874  * assert nDOF_test_element == nSpace+1
13875  */
13876  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error)
13877  __Pyx_GOTREF(__pyx_t_1);
13878  __Pyx_INCREF(((PyObject *)__pyx_v_q_u));
13879  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_u));
13880  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_q_u));
13881  __Pyx_INCREF(((PyObject *)__pyx_v_q_m));
13882  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_m));
13883  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_q_m));
13884  __Pyx_INCREF(((PyObject *)__pyx_v_q_mt));
13885  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_mt));
13886  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_q_mt));
13887  __Pyx_INCREF(((PyObject *)__pyx_v_q_r));
13888  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_r));
13889  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_q_r));
13890  __Pyx_INCREF(((PyObject *)__pyx_v_q_kr));
13891  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_kr));
13892  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_q_kr));
13893  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
13894  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13895  for (;;) {
13896  if (__pyx_t_3 >= 5) break;
13897  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13898  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 623, __pyx_L1_error)
13899  #else
13900  __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error)
13901  __Pyx_GOTREF(__pyx_t_1);
13902  #endif
13903  __Pyx_XDECREF_SET(__pyx_v_q, __pyx_t_1);
13904  __pyx_t_1 = 0;
13905 
13906  /* "subsurfaceTransportFunctions.pyx":624
13907  * #check some sizes
13908  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
13909  * assert q.shape[1] == nSpace+1 # <<<<<<<<<<<<<<
13910  * assert nDOF_test_element == nSpace+1
13911  * cdef int nnz = rowptr[nSpace]
13912  */
13913  #ifndef CYTHON_WITHOUT_ASSERTIONS
13914  if (unlikely(!Py_OptimizeFlag)) {
13915  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_q, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error)
13916  __Pyx_GOTREF(__pyx_t_1);
13917  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 624, __pyx_L1_error)
13918  __Pyx_GOTREF(__pyx_t_4);
13919  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13920  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_nSpace + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error)
13921  __Pyx_GOTREF(__pyx_t_1);
13922  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 624, __pyx_L1_error)
13923  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13924  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13925  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 624, __pyx_L1_error)
13926  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13927  if (unlikely(!__pyx_t_6)) {
13928  PyErr_SetNone(PyExc_AssertionError);
13929  __PYX_ERR(0, 624, __pyx_L1_error)
13930  }
13931  }
13932  #endif
13933 
13934  /* "subsurfaceTransportFunctions.pyx":623
13935  * cdef int picard = 1
13936  * #check some sizes
13937  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
13938  * assert q.shape[1] == nSpace+1
13939  * assert nDOF_test_element == nSpace+1
13940  */
13941  }
13942  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13943 
13944  /* "subsurfaceTransportFunctions.pyx":625
13945  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
13946  * assert q.shape[1] == nSpace+1
13947  * assert nDOF_test_element == nSpace+1 # <<<<<<<<<<<<<<
13948  * cdef int nnz = rowptr[nSpace]
13949  * #temporaries
13950  */
13951  #ifndef CYTHON_WITHOUT_ASSERTIONS
13952  if (unlikely(!Py_OptimizeFlag)) {
13953  if (unlikely(!((__pyx_v_nDOF_test_element == (__pyx_v_nSpace + 1)) != 0))) {
13954  PyErr_SetNone(PyExc_AssertionError);
13955  __PYX_ERR(0, 625, __pyx_L1_error)
13956  }
13957  }
13958  #endif
13959 
13960  /* "subsurfaceTransportFunctions.pyx":626
13961  * assert q.shape[1] == nSpace+1
13962  * assert nDOF_test_element == nSpace+1
13963  * cdef int nnz = rowptr[nSpace] # <<<<<<<<<<<<<<
13964  * #temporaries
13965  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig,dkr_up
13966  */
13967  __pyx_t_7 = __pyx_v_nSpace;
13968  __pyx_t_8 = -1;
13969  if (__pyx_t_7 < 0) {
13970  __pyx_t_7 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
13971  if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 0;
13972  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_8 = 0;
13973  if (unlikely(__pyx_t_8 != -1)) {
13974  __Pyx_RaiseBufferIndexError(__pyx_t_8);
13975  __PYX_ERR(0, 626, __pyx_L1_error)
13976  }
13977  __pyx_v_nnz = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_rowptr.diminfo[0].strides));
13978 
13979  /* "subsurfaceTransportFunctions.pyx":630
13980  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig,dkr_up
13981  * cdef int eN,eN_neighbor,ii,I
13982  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
13983  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
13984  * #for averaging/integration weights
13985  */
13986  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 630, __pyx_L1_error)
13987  __Pyx_GOTREF(__pyx_t_5);
13988  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 630, __pyx_L1_error)
13989  __Pyx_GOTREF(__pyx_t_1);
13990  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13991  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 630, __pyx_L1_error)
13992  __Pyx_GOTREF(__pyx_t_5);
13993  __pyx_t_4 = NULL;
13994  __pyx_t_8 = 0;
13995  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
13996  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
13997  if (likely(__pyx_t_4)) {
13998  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
13999  __Pyx_INCREF(__pyx_t_4);
14000  __Pyx_INCREF(function);
14001  __Pyx_DECREF_SET(__pyx_t_1, function);
14002  __pyx_t_8 = 1;
14003  }
14004  }
14005  #if CYTHON_FAST_PYCALL
14006  if (PyFunction_Check(__pyx_t_1)) {
14007  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
14008  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 630, __pyx_L1_error)
14009  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
14010  __Pyx_GOTREF(__pyx_t_2);
14011  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14012  } else
14013  #endif
14014  #if CYTHON_FAST_PYCCALL
14015  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
14016  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
14017  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 630, __pyx_L1_error)
14018  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
14019  __Pyx_GOTREF(__pyx_t_2);
14020  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14021  } else
14022  #endif
14023  {
14024  __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 630, __pyx_L1_error)
14025  __Pyx_GOTREF(__pyx_t_9);
14026  if (__pyx_t_4) {
14027  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL;
14028  }
14029  __Pyx_GIVEREF(__pyx_t_5);
14030  PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_5);
14031  __Pyx_INCREF(__pyx_n_s_d);
14032  __Pyx_GIVEREF(__pyx_n_s_d);
14033  PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_n_s_d);
14034  __pyx_t_5 = 0;
14035  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 630, __pyx_L1_error)
14036  __Pyx_GOTREF(__pyx_t_2);
14037  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14038  }
14039  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14040  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 630, __pyx_L1_error)
14041  __pyx_t_10 = ((PyArrayObject *)__pyx_t_2);
14042  {
14043  __Pyx_BufFmt_StackElem __pyx_stack[1];
14044  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
14045  __pyx_v_a_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf = NULL;
14046  __PYX_ERR(0, 630, __pyx_L1_error)
14047  } else {__pyx_pybuffernd_a_up.diminfo[0].strides = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_up.diminfo[0].shape = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.shape[0];
14048  }
14049  }
14050  __pyx_t_10 = 0;
14051  __pyx_v_a_up = ((PyArrayObject *)__pyx_t_2);
14052  __pyx_t_2 = 0;
14053 
14054  /* "subsurfaceTransportFunctions.pyx":631
14055  * cdef int eN,eN_neighbor,ii,I
14056  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d')
14057  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d') # <<<<<<<<<<<<<<
14058  * #for averaging/integration weights
14059  * cdef double nAvgWeight = 1.0/(nSpace+1.)
14060  */
14061  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 631, __pyx_L1_error)
14062  __Pyx_GOTREF(__pyx_t_1);
14063  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 631, __pyx_L1_error)
14064  __Pyx_GOTREF(__pyx_t_9);
14065  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14066  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nSpace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 631, __pyx_L1_error)
14067  __Pyx_GOTREF(__pyx_t_1);
14068  __pyx_t_5 = NULL;
14069  __pyx_t_8 = 0;
14070  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
14071  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
14072  if (likely(__pyx_t_5)) {
14073  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
14074  __Pyx_INCREF(__pyx_t_5);
14075  __Pyx_INCREF(function);
14076  __Pyx_DECREF_SET(__pyx_t_9, function);
14077  __pyx_t_8 = 1;
14078  }
14079  }
14080  #if CYTHON_FAST_PYCALL
14081  if (PyFunction_Check(__pyx_t_9)) {
14082  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_n_s_d};
14083  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 631, __pyx_L1_error)
14084  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14085  __Pyx_GOTREF(__pyx_t_2);
14086  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14087  } else
14088  #endif
14089  #if CYTHON_FAST_PYCCALL
14090  if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
14091  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_n_s_d};
14092  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 631, __pyx_L1_error)
14093  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14094  __Pyx_GOTREF(__pyx_t_2);
14095  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14096  } else
14097  #endif
14098  {
14099  __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 631, __pyx_L1_error)
14100  __Pyx_GOTREF(__pyx_t_4);
14101  if (__pyx_t_5) {
14102  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
14103  }
14104  __Pyx_GIVEREF(__pyx_t_1);
14105  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_t_1);
14106  __Pyx_INCREF(__pyx_n_s_d);
14107  __Pyx_GIVEREF(__pyx_n_s_d);
14108  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_n_s_d);
14109  __pyx_t_1 = 0;
14110  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 631, __pyx_L1_error)
14111  __Pyx_GOTREF(__pyx_t_2);
14112  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14113  }
14114  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14115  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 631, __pyx_L1_error)
14116  __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
14117  {
14118  __Pyx_BufFmt_StackElem __pyx_stack[1];
14119  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
14120  __pyx_v_f_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf = NULL;
14121  __PYX_ERR(0, 631, __pyx_L1_error)
14122  } else {__pyx_pybuffernd_f_up.diminfo[0].strides = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f_up.diminfo[0].shape = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.shape[0];
14123  }
14124  }
14125  __pyx_t_11 = 0;
14126  __pyx_v_f_up = ((PyArrayObject *)__pyx_t_2);
14127  __pyx_t_2 = 0;
14128 
14129  /* "subsurfaceTransportFunctions.pyx":633
14130  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
14131  * #for averaging/integration weights
14132  * cdef double nAvgWeight = 1.0/(nSpace+1.) # <<<<<<<<<<<<<<
14133  * cdef double weight=1.0,volFactor = 1.0
14134  * cdef int thisElementIsUpwind = 1
14135  */
14136  __pyx_t_12 = (__pyx_v_nSpace + 1.);
14137  if (unlikely(__pyx_t_12 == 0)) {
14138  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
14139  __PYX_ERR(0, 633, __pyx_L1_error)
14140  }
14141  __pyx_v_nAvgWeight = (1.0 / __pyx_t_12);
14142 
14143  /* "subsurfaceTransportFunctions.pyx":634
14144  * #for averaging/integration weights
14145  * cdef double nAvgWeight = 1.0/(nSpace+1.)
14146  * cdef double weight=1.0,volFactor = 1.0 # <<<<<<<<<<<<<<
14147  * cdef int thisElementIsUpwind = 1
14148  * if nSpace == 2:
14149  */
14150  __pyx_v_weight = 1.0;
14151  __pyx_v_volFactor = 1.0;
14152 
14153  /* "subsurfaceTransportFunctions.pyx":635
14154  * cdef double nAvgWeight = 1.0/(nSpace+1.)
14155  * cdef double weight=1.0,volFactor = 1.0
14156  * cdef int thisElementIsUpwind = 1 # <<<<<<<<<<<<<<
14157  * if nSpace == 2:
14158  * volFactor = 0.5
14159  */
14160  __pyx_v_thisElementIsUpwind = 1;
14161 
14162  /* "subsurfaceTransportFunctions.pyx":636
14163  * cdef double weight=1.0,volFactor = 1.0
14164  * cdef int thisElementIsUpwind = 1
14165  * if nSpace == 2: # <<<<<<<<<<<<<<
14166  * volFactor = 0.5
14167  * if nSpace == 3:
14168  */
14169  __pyx_t_6 = ((__pyx_v_nSpace == 2) != 0);
14170  if (__pyx_t_6) {
14171 
14172  /* "subsurfaceTransportFunctions.pyx":637
14173  * cdef int thisElementIsUpwind = 1
14174  * if nSpace == 2:
14175  * volFactor = 0.5 # <<<<<<<<<<<<<<
14176  * if nSpace == 3:
14177  * volFactor = 1.0/6.0
14178  */
14179  __pyx_v_volFactor = 0.5;
14180 
14181  /* "subsurfaceTransportFunctions.pyx":636
14182  * cdef double weight=1.0,volFactor = 1.0
14183  * cdef int thisElementIsUpwind = 1
14184  * if nSpace == 2: # <<<<<<<<<<<<<<
14185  * volFactor = 0.5
14186  * if nSpace == 3:
14187  */
14188  }
14189 
14190  /* "subsurfaceTransportFunctions.pyx":638
14191  * if nSpace == 2:
14192  * volFactor = 0.5
14193  * if nSpace == 3: # <<<<<<<<<<<<<<
14194  * volFactor = 1.0/6.0
14195  * #
14196  */
14197  __pyx_t_6 = ((__pyx_v_nSpace == 3) != 0);
14198  if (__pyx_t_6) {
14199 
14200  /* "subsurfaceTransportFunctions.pyx":639
14201  * volFactor = 0.5
14202  * if nSpace == 3:
14203  * volFactor = 1.0/6.0 # <<<<<<<<<<<<<<
14204  * #
14205  * for eN in range(nElements_global):
14206  */
14207  __pyx_v_volFactor = (1.0 / 6.0);
14208 
14209  /* "subsurfaceTransportFunctions.pyx":638
14210  * if nSpace == 2:
14211  * volFactor = 0.5
14212  * if nSpace == 3: # <<<<<<<<<<<<<<
14213  * volFactor = 1.0/6.0
14214  * #
14215  */
14216  }
14217 
14218  /* "subsurfaceTransportFunctions.pyx":641
14219  * volFactor = 1.0/6.0
14220  * #
14221  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
14222  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
14223  * weight = nAvgWeight*volume
14224  */
14225  __pyx_t_8 = __pyx_v_nElements_global;
14226  __pyx_t_13 = __pyx_t_8;
14227  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
14228  __pyx_v_eN = __pyx_t_14;
14229 
14230  /* "subsurfaceTransportFunctions.pyx":642
14231  * #
14232  * for eN in range(nElements_global):
14233  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation # <<<<<<<<<<<<<<
14234  * weight = nAvgWeight*volume
14235  *
14236  */
14237  __pyx_t_15 = __pyx_v_eN;
14238  __pyx_t_16 = 0;
14239  __pyx_t_17 = -1;
14240  if (__pyx_t_15 < 0) {
14241  __pyx_t_15 += __pyx_pybuffernd_q_detJ.diminfo[0].shape;
14242  if (unlikely(__pyx_t_15 < 0)) __pyx_t_17 = 0;
14243  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_detJ.diminfo[0].shape)) __pyx_t_17 = 0;
14244  if (__pyx_t_16 < 0) {
14245  __pyx_t_16 += __pyx_pybuffernd_q_detJ.diminfo[1].shape;
14246  if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 1;
14247  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_q_detJ.diminfo[1].shape)) __pyx_t_17 = 1;
14248  if (unlikely(__pyx_t_17 != -1)) {
14249  __Pyx_RaiseBufferIndexError(__pyx_t_17);
14250  __PYX_ERR(0, 642, __pyx_L1_error)
14251  }
14252  __pyx_v_volume = (__pyx_v_volFactor * fabs((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_q_detJ.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_q_detJ.diminfo[1].strides))));
14253 
14254  /* "subsurfaceTransportFunctions.pyx":643
14255  * for eN in range(nElements_global):
14256  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
14257  * weight = nAvgWeight*volume # <<<<<<<<<<<<<<
14258  *
14259  *
14260  */
14261  __pyx_v_weight = (__pyx_v_nAvgWeight * __pyx_v_volume);
14262 
14263  /* "subsurfaceTransportFunctions.pyx":646
14264  *
14265  *
14266  * for i in range(nDOF_test_element): # <<<<<<<<<<<<<<
14267  * #nodal quadrature so diagonal
14268  * ##mass
14269  */
14270  __pyx_t_17 = __pyx_v_nDOF_test_element;
14271  __pyx_t_18 = __pyx_t_17;
14272  for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
14273  __pyx_v_i = __pyx_t_19;
14274 
14275  /* "subsurfaceTransportFunctions.pyx":650
14276  * ##mass
14277  * #elementResidual[eN,i] += weight*q_m[eN,i]
14278  * elementJacobian[eN,i,i] += weight*q_dmt[eN,i] # <<<<<<<<<<<<<<
14279  *
14280  * #have to actually compute loop over other nodes for stiffness terms
14281  */
14282  __pyx_t_20 = __pyx_v_eN;
14283  __pyx_t_21 = __pyx_v_i;
14284  __pyx_t_22 = -1;
14285  if (__pyx_t_20 < 0) {
14286  __pyx_t_20 += __pyx_pybuffernd_q_dmt.diminfo[0].shape;
14287  if (unlikely(__pyx_t_20 < 0)) __pyx_t_22 = 0;
14288  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_q_dmt.diminfo[0].shape)) __pyx_t_22 = 0;
14289  if (__pyx_t_21 < 0) {
14290  __pyx_t_21 += __pyx_pybuffernd_q_dmt.diminfo[1].shape;
14291  if (unlikely(__pyx_t_21 < 0)) __pyx_t_22 = 1;
14292  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_q_dmt.diminfo[1].shape)) __pyx_t_22 = 1;
14293  if (unlikely(__pyx_t_22 != -1)) {
14294  __Pyx_RaiseBufferIndexError(__pyx_t_22);
14295  __PYX_ERR(0, 650, __pyx_L1_error)
14296  }
14297  __pyx_t_23 = __pyx_v_eN;
14298  __pyx_t_24 = __pyx_v_i;
14299  __pyx_t_25 = __pyx_v_i;
14300  __pyx_t_22 = -1;
14301  if (__pyx_t_23 < 0) {
14302  __pyx_t_23 += __pyx_pybuffernd_elementJacobian.diminfo[0].shape;
14303  if (unlikely(__pyx_t_23 < 0)) __pyx_t_22 = 0;
14304  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_elementJacobian.diminfo[0].shape)) __pyx_t_22 = 0;
14305  if (__pyx_t_24 < 0) {
14306  __pyx_t_24 += __pyx_pybuffernd_elementJacobian.diminfo[1].shape;
14307  if (unlikely(__pyx_t_24 < 0)) __pyx_t_22 = 1;
14308  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_elementJacobian.diminfo[1].shape)) __pyx_t_22 = 1;
14309  if (__pyx_t_25 < 0) {
14310  __pyx_t_25 += __pyx_pybuffernd_elementJacobian.diminfo[2].shape;
14311  if (unlikely(__pyx_t_25 < 0)) __pyx_t_22 = 2;
14312  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_elementJacobian.diminfo[2].shape)) __pyx_t_22 = 2;
14313  if (unlikely(__pyx_t_22 != -1)) {
14314  __Pyx_RaiseBufferIndexError(__pyx_t_22);
14315  __PYX_ERR(0, 650, __pyx_L1_error)
14316  }
14317  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_elementJacobian.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_elementJacobian.diminfo[1].strides, __pyx_t_25, __pyx_pybuffernd_elementJacobian.diminfo[2].strides) += (__pyx_v_weight * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_q_dmt.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_q_dmt.diminfo[1].strides)));
14318 
14319  /* "subsurfaceTransportFunctions.pyx":653
14320  *
14321  * #have to actually compute loop over other nodes for stiffness terms
14322  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_ # <<<<<<<<<<<<<<
14323  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
14324  * for ii in range(nnz):
14325  */
14326  __pyx_t_22 = __pyx_v_nElementBoundaries_element;
14327  __pyx_t_26 = __pyx_t_22;
14328  for (__pyx_t_27 = 0; __pyx_t_27 < __pyx_t_26; __pyx_t_27+=1) {
14329  __pyx_v_ebN = __pyx_t_27;
14330 
14331  /* "subsurfaceTransportFunctions.pyx":655
14332  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_
14333  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
14334  * for ii in range(nnz): # <<<<<<<<<<<<<<
14335  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
14336  * for I in range(nSpace):
14337  */
14338  __pyx_t_28 = __pyx_v_nnz;
14339  __pyx_t_29 = __pyx_t_28;
14340  for (__pyx_t_30 = 0; __pyx_t_30 < __pyx_t_29; __pyx_t_30+=1) {
14341  __pyx_v_ii = __pyx_t_30;
14342 
14343  /* "subsurfaceTransportFunctions.pyx":656
14344  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
14345  * for ii in range(nnz):
14346  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
14347  * for I in range(nSpace):
14348  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
14349  */
14350  __pyx_t_31 = __pyx_v_eN;
14351  __pyx_t_32 = __pyx_v_ebN;
14352  __pyx_t_33 = __pyx_v_ii;
14353  __pyx_t_34 = -1;
14354  if (__pyx_t_31 < 0) {
14355  __pyx_t_31 += __pyx_pybuffernd_q_alin.diminfo[0].shape;
14356  if (unlikely(__pyx_t_31 < 0)) __pyx_t_34 = 0;
14357  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_q_alin.diminfo[0].shape)) __pyx_t_34 = 0;
14358  if (__pyx_t_32 < 0) {
14359  __pyx_t_32 += __pyx_pybuffernd_q_alin.diminfo[1].shape;
14360  if (unlikely(__pyx_t_32 < 0)) __pyx_t_34 = 1;
14361  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_q_alin.diminfo[1].shape)) __pyx_t_34 = 1;
14362  if (__pyx_t_33 < 0) {
14363  __pyx_t_33 += __pyx_pybuffernd_q_alin.diminfo[2].shape;
14364  if (unlikely(__pyx_t_33 < 0)) __pyx_t_34 = 2;
14365  } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_q_alin.diminfo[2].shape)) __pyx_t_34 = 2;
14366  if (unlikely(__pyx_t_34 != -1)) {
14367  __Pyx_RaiseBufferIndexError(__pyx_t_34);
14368  __PYX_ERR(0, 656, __pyx_L1_error)
14369  }
14370  __pyx_t_35 = __pyx_v_eN;
14371  __pyx_t_36 = __pyx_v_ebN;
14372  __pyx_t_34 = -1;
14373  if (__pyx_t_35 < 0) {
14374  __pyx_t_35 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
14375  if (unlikely(__pyx_t_35 < 0)) __pyx_t_34 = 0;
14376  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_34 = 0;
14377  if (__pyx_t_36 < 0) {
14378  __pyx_t_36 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
14379  if (unlikely(__pyx_t_36 < 0)) __pyx_t_34 = 1;
14380  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_34 = 1;
14381  if (unlikely(__pyx_t_34 != -1)) {
14382  __Pyx_RaiseBufferIndexError(__pyx_t_34);
14383  __PYX_ERR(0, 656, __pyx_L1_error)
14384  }
14385  __pyx_t_37 = __pyx_v_ii;
14386  __pyx_t_34 = -1;
14387  if (__pyx_t_37 < 0) {
14388  __pyx_t_37 += __pyx_pybuffernd_a_up.diminfo[0].shape;
14389  if (unlikely(__pyx_t_37 < 0)) __pyx_t_34 = 0;
14390  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_34 = 0;
14391  if (unlikely(__pyx_t_34 != -1)) {
14392  __Pyx_RaiseBufferIndexError(__pyx_t_34);
14393  __PYX_ERR(0, 656, __pyx_L1_error)
14394  }
14395  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_a_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_q_alin.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_q_alin.diminfo[1].strides, __pyx_t_33, __pyx_pybuffernd_q_alin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
14396  }
14397 
14398  /* "subsurfaceTransportFunctions.pyx":657
14399  * for ii in range(nnz):
14400  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
14401  * for I in range(nSpace): # <<<<<<<<<<<<<<
14402  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
14403  * #
14404  */
14405  __pyx_t_28 = __pyx_v_nSpace;
14406  __pyx_t_29 = __pyx_t_28;
14407  for (__pyx_t_30 = 0; __pyx_t_30 < __pyx_t_29; __pyx_t_30+=1) {
14408  __pyx_v_I = __pyx_t_30;
14409 
14410  /* "subsurfaceTransportFunctions.pyx":658
14411  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
14412  * for I in range(nSpace):
14413  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
14414  * #
14415  *
14416  */
14417  __pyx_t_38 = __pyx_v_eN;
14418  __pyx_t_39 = __pyx_v_ebN;
14419  __pyx_t_40 = __pyx_v_I;
14420  __pyx_t_34 = -1;
14421  if (__pyx_t_38 < 0) {
14422  __pyx_t_38 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
14423  if (unlikely(__pyx_t_38 < 0)) __pyx_t_34 = 0;
14424  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_34 = 0;
14425  if (__pyx_t_39 < 0) {
14426  __pyx_t_39 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
14427  if (unlikely(__pyx_t_39 < 0)) __pyx_t_34 = 1;
14428  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_34 = 1;
14429  if (__pyx_t_40 < 0) {
14430  __pyx_t_40 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
14431  if (unlikely(__pyx_t_40 < 0)) __pyx_t_34 = 2;
14432  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_34 = 2;
14433  if (unlikely(__pyx_t_34 != -1)) {
14434  __Pyx_RaiseBufferIndexError(__pyx_t_34);
14435  __PYX_ERR(0, 658, __pyx_L1_error)
14436  }
14437  __pyx_t_41 = __pyx_v_eN;
14438  __pyx_t_42 = __pyx_v_ebN;
14439  __pyx_t_34 = -1;
14440  if (__pyx_t_41 < 0) {
14441  __pyx_t_41 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
14442  if (unlikely(__pyx_t_41 < 0)) __pyx_t_34 = 0;
14443  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_34 = 0;
14444  if (__pyx_t_42 < 0) {
14445  __pyx_t_42 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
14446  if (unlikely(__pyx_t_42 < 0)) __pyx_t_34 = 1;
14447  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_34 = 1;
14448  if (unlikely(__pyx_t_34 != -1)) {
14449  __Pyx_RaiseBufferIndexError(__pyx_t_34);
14450  __PYX_ERR(0, 658, __pyx_L1_error)
14451  }
14452  __pyx_t_43 = __pyx_v_I;
14453  __pyx_t_34 = -1;
14454  if (__pyx_t_43 < 0) {
14455  __pyx_t_43 += __pyx_pybuffernd_f_up.diminfo[0].shape;
14456  if (unlikely(__pyx_t_43 < 0)) __pyx_t_34 = 0;
14457  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_f_up.diminfo[0].shape)) __pyx_t_34 = 0;
14458  if (unlikely(__pyx_t_34 != -1)) {
14459  __Pyx_RaiseBufferIndexError(__pyx_t_34);
14460  __PYX_ERR(0, 658, __pyx_L1_error)
14461  }
14462  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_f_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_40, __pyx_pybuffernd_q_flin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
14463  }
14464 
14465  /* "subsurfaceTransportFunctions.pyx":662
14466  *
14467  * #Picard part first
14468  * for j in range(nDOF_trial_element): # <<<<<<<<<<<<<<
14469  * for I in range(nSpace):
14470  * for ii in range(rowptr[I],rowptr[I+1]):
14471  */
14472  __pyx_t_28 = __pyx_v_nDOF_trial_element;
14473  __pyx_t_29 = __pyx_t_28;
14474  for (__pyx_t_30 = 0; __pyx_t_30 < __pyx_t_29; __pyx_t_30+=1) {
14475  __pyx_v_j = __pyx_t_30;
14476 
14477  /* "subsurfaceTransportFunctions.pyx":663
14478  * #Picard part first
14479  * for j in range(nDOF_trial_element):
14480  * for I in range(nSpace): # <<<<<<<<<<<<<<
14481  * for ii in range(rowptr[I],rowptr[I+1]):
14482  * elementJacobian[eN,i,j] += weight*a_up[ii]*q_grad_v[eN,ebN,j,colind[ii]]*q_grad_w[eN,ebN,i,I]
14483  */
14484  __pyx_t_34 = __pyx_v_nSpace;
14485  __pyx_t_44 = __pyx_t_34;
14486  for (__pyx_t_45 = 0; __pyx_t_45 < __pyx_t_44; __pyx_t_45+=1) {
14487  __pyx_v_I = __pyx_t_45;
14488 
14489  /* "subsurfaceTransportFunctions.pyx":664
14490  * for j in range(nDOF_trial_element):
14491  * for I in range(nSpace):
14492  * for ii in range(rowptr[I],rowptr[I+1]): # <<<<<<<<<<<<<<
14493  * elementJacobian[eN,i,j] += weight*a_up[ii]*q_grad_v[eN,ebN,j,colind[ii]]*q_grad_w[eN,ebN,i,I]
14494  * #j picard
14495  */
14496  __pyx_t_46 = (__pyx_v_I + 1);
14497  __pyx_t_47 = -1;
14498  if (__pyx_t_46 < 0) {
14499  __pyx_t_46 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
14500  if (unlikely(__pyx_t_46 < 0)) __pyx_t_47 = 0;
14501  } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_47 = 0;
14502  if (unlikely(__pyx_t_47 != -1)) {
14503  __Pyx_RaiseBufferIndexError(__pyx_t_47);
14504  __PYX_ERR(0, 664, __pyx_L1_error)
14505  }
14506  __pyx_t_48 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_rowptr.diminfo[0].strides));
14507  __pyx_t_49 = __pyx_v_I;
14508  __pyx_t_47 = -1;
14509  if (__pyx_t_49 < 0) {
14510  __pyx_t_49 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
14511  if (unlikely(__pyx_t_49 < 0)) __pyx_t_47 = 0;
14512  } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_47 = 0;
14513  if (unlikely(__pyx_t_47 != -1)) {
14514  __Pyx_RaiseBufferIndexError(__pyx_t_47);
14515  __PYX_ERR(0, 664, __pyx_L1_error)
14516  }
14517  __pyx_t_50 = __pyx_t_48;
14518  for (__pyx_t_47 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_rowptr.diminfo[0].strides)); __pyx_t_47 < __pyx_t_50; __pyx_t_47+=1) {
14519  __pyx_v_ii = __pyx_t_47;
14520 
14521  /* "subsurfaceTransportFunctions.pyx":665
14522  * for I in range(nSpace):
14523  * for ii in range(rowptr[I],rowptr[I+1]):
14524  * elementJacobian[eN,i,j] += weight*a_up[ii]*q_grad_v[eN,ebN,j,colind[ii]]*q_grad_w[eN,ebN,i,I] # <<<<<<<<<<<<<<
14525  * #j picard
14526  * #i
14527  */
14528  __pyx_t_51 = __pyx_v_ii;
14529  __pyx_t_52 = -1;
14530  if (__pyx_t_51 < 0) {
14531  __pyx_t_51 += __pyx_pybuffernd_a_up.diminfo[0].shape;
14532  if (unlikely(__pyx_t_51 < 0)) __pyx_t_52 = 0;
14533  } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_52 = 0;
14534  if (unlikely(__pyx_t_52 != -1)) {
14535  __Pyx_RaiseBufferIndexError(__pyx_t_52);
14536  __PYX_ERR(0, 665, __pyx_L1_error)
14537  }
14538  __pyx_t_53 = __pyx_v_ii;
14539  __pyx_t_52 = -1;
14540  if (__pyx_t_53 < 0) {
14541  __pyx_t_53 += __pyx_pybuffernd_colind.diminfo[0].shape;
14542  if (unlikely(__pyx_t_53 < 0)) __pyx_t_52 = 0;
14543  } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_colind.diminfo[0].shape)) __pyx_t_52 = 0;
14544  if (unlikely(__pyx_t_52 != -1)) {
14545  __Pyx_RaiseBufferIndexError(__pyx_t_52);
14546  __PYX_ERR(0, 665, __pyx_L1_error)
14547  }
14548  __pyx_t_54 = __pyx_v_eN;
14549  __pyx_t_55 = __pyx_v_ebN;
14550  __pyx_t_56 = __pyx_v_j;
14551  __pyx_t_57 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_colind.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_colind.diminfo[0].strides));
14552  __pyx_t_52 = -1;
14553  if (__pyx_t_54 < 0) {
14554  __pyx_t_54 += __pyx_pybuffernd_q_grad_v.diminfo[0].shape;
14555  if (unlikely(__pyx_t_54 < 0)) __pyx_t_52 = 0;
14556  } else if (unlikely(__pyx_t_54 >= __pyx_pybuffernd_q_grad_v.diminfo[0].shape)) __pyx_t_52 = 0;
14557  if (__pyx_t_55 < 0) {
14558  __pyx_t_55 += __pyx_pybuffernd_q_grad_v.diminfo[1].shape;
14559  if (unlikely(__pyx_t_55 < 0)) __pyx_t_52 = 1;
14560  } else if (unlikely(__pyx_t_55 >= __pyx_pybuffernd_q_grad_v.diminfo[1].shape)) __pyx_t_52 = 1;
14561  if (__pyx_t_56 < 0) {
14562  __pyx_t_56 += __pyx_pybuffernd_q_grad_v.diminfo[2].shape;
14563  if (unlikely(__pyx_t_56 < 0)) __pyx_t_52 = 2;
14564  } else if (unlikely(__pyx_t_56 >= __pyx_pybuffernd_q_grad_v.diminfo[2].shape)) __pyx_t_52 = 2;
14565  if (__pyx_t_57 < 0) {
14566  __pyx_t_57 += __pyx_pybuffernd_q_grad_v.diminfo[3].shape;
14567  if (unlikely(__pyx_t_57 < 0)) __pyx_t_52 = 3;
14568  } else if (unlikely(__pyx_t_57 >= __pyx_pybuffernd_q_grad_v.diminfo[3].shape)) __pyx_t_52 = 3;
14569  if (unlikely(__pyx_t_52 != -1)) {
14570  __Pyx_RaiseBufferIndexError(__pyx_t_52);
14571  __PYX_ERR(0, 665, __pyx_L1_error)
14572  }
14573  __pyx_t_58 = __pyx_v_eN;
14574  __pyx_t_59 = __pyx_v_ebN;
14575  __pyx_t_60 = __pyx_v_i;
14576  __pyx_t_61 = __pyx_v_I;
14577  __pyx_t_52 = -1;
14578  if (__pyx_t_58 < 0) {
14579  __pyx_t_58 += __pyx_pybuffernd_q_grad_w.diminfo[0].shape;
14580  if (unlikely(__pyx_t_58 < 0)) __pyx_t_52 = 0;
14581  } else if (unlikely(__pyx_t_58 >= __pyx_pybuffernd_q_grad_w.diminfo[0].shape)) __pyx_t_52 = 0;
14582  if (__pyx_t_59 < 0) {
14583  __pyx_t_59 += __pyx_pybuffernd_q_grad_w.diminfo[1].shape;
14584  if (unlikely(__pyx_t_59 < 0)) __pyx_t_52 = 1;
14585  } else if (unlikely(__pyx_t_59 >= __pyx_pybuffernd_q_grad_w.diminfo[1].shape)) __pyx_t_52 = 1;
14586  if (__pyx_t_60 < 0) {
14587  __pyx_t_60 += __pyx_pybuffernd_q_grad_w.diminfo[2].shape;
14588  if (unlikely(__pyx_t_60 < 0)) __pyx_t_52 = 2;
14589  } else if (unlikely(__pyx_t_60 >= __pyx_pybuffernd_q_grad_w.diminfo[2].shape)) __pyx_t_52 = 2;
14590  if (__pyx_t_61 < 0) {
14591  __pyx_t_61 += __pyx_pybuffernd_q_grad_w.diminfo[3].shape;
14592  if (unlikely(__pyx_t_61 < 0)) __pyx_t_52 = 3;
14593  } else if (unlikely(__pyx_t_61 >= __pyx_pybuffernd_q_grad_w.diminfo[3].shape)) __pyx_t_52 = 3;
14594  if (unlikely(__pyx_t_52 != -1)) {
14595  __Pyx_RaiseBufferIndexError(__pyx_t_52);
14596  __PYX_ERR(0, 665, __pyx_L1_error)
14597  }
14598  __pyx_t_62 = __pyx_v_eN;
14599  __pyx_t_63 = __pyx_v_i;
14600  __pyx_t_64 = __pyx_v_j;
14601  __pyx_t_52 = -1;
14602  if (__pyx_t_62 < 0) {
14603  __pyx_t_62 += __pyx_pybuffernd_elementJacobian.diminfo[0].shape;
14604  if (unlikely(__pyx_t_62 < 0)) __pyx_t_52 = 0;
14605  } else if (unlikely(__pyx_t_62 >= __pyx_pybuffernd_elementJacobian.diminfo[0].shape)) __pyx_t_52 = 0;
14606  if (__pyx_t_63 < 0) {
14607  __pyx_t_63 += __pyx_pybuffernd_elementJacobian.diminfo[1].shape;
14608  if (unlikely(__pyx_t_63 < 0)) __pyx_t_52 = 1;
14609  } else if (unlikely(__pyx_t_63 >= __pyx_pybuffernd_elementJacobian.diminfo[1].shape)) __pyx_t_52 = 1;
14610  if (__pyx_t_64 < 0) {
14611  __pyx_t_64 += __pyx_pybuffernd_elementJacobian.diminfo[2].shape;
14612  if (unlikely(__pyx_t_64 < 0)) __pyx_t_52 = 2;
14613  } else if (unlikely(__pyx_t_64 >= __pyx_pybuffernd_elementJacobian.diminfo[2].shape)) __pyx_t_52 = 2;
14614  if (unlikely(__pyx_t_52 != -1)) {
14615  __Pyx_RaiseBufferIndexError(__pyx_t_52);
14616  __PYX_ERR(0, 665, __pyx_L1_error)
14617  }
14618  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.buf, __pyx_t_62, __pyx_pybuffernd_elementJacobian.diminfo[0].strides, __pyx_t_63, __pyx_pybuffernd_elementJacobian.diminfo[1].strides, __pyx_t_64, __pyx_pybuffernd_elementJacobian.diminfo[2].strides) += (((__pyx_v_weight * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_a_up.diminfo[0].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_q_grad_v.diminfo[0].strides, __pyx_t_55, __pyx_pybuffernd_q_grad_v.diminfo[1].strides, __pyx_t_56, __pyx_pybuffernd_q_grad_v.diminfo[2].strides, __pyx_t_57, __pyx_pybuffernd_q_grad_v.diminfo[3].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_q_grad_w.diminfo[0].strides, __pyx_t_59, __pyx_pybuffernd_q_grad_w.diminfo[1].strides, __pyx_t_60, __pyx_pybuffernd_q_grad_w.diminfo[2].strides, __pyx_t_61, __pyx_pybuffernd_q_grad_w.diminfo[3].strides)));
14619  }
14620  }
14621  }
14622  }
14623  }
14624  }
14625 
14626  /* "subsurfaceTransportFunctions.pyx":574
14627  * #i
14628  * #eN
14629  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
14630  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
14631  * numpy.ndarray[ITYPE_t,ndim=1] colind,
14632  */
14633 
14634  /* function exit code */
14635  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14636  goto __pyx_L0;
14637  __pyx_L1_error:;
14638  __Pyx_XDECREF(__pyx_t_1);
14639  __Pyx_XDECREF(__pyx_t_2);
14640  __Pyx_XDECREF(__pyx_t_4);
14641  __Pyx_XDECREF(__pyx_t_5);
14642  __Pyx_XDECREF(__pyx_t_9);
14643  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
14644  __Pyx_PyThreadState_declare
14645  __Pyx_PyThreadState_assign
14646  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
14647  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
14648  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
14649  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
14650  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer);
14651  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
14652  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
14653  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
14654  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
14655  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
14656  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
14657  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dm.rcbuffer->pybuffer);
14658  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmt.rcbuffer->pybuffer);
14659  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
14660  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
14661  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer);
14662  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
14663  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
14664  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
14665  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
14666  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
14667  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
14668  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
14669  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
14670  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
14671  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
14672  __pyx_r = NULL;
14673  goto __pyx_L2;
14674  __pyx_L0:;
14675  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
14676  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
14677  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
14678  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer);
14679  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
14680  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
14681  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
14682  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
14683  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
14684  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
14685  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dm.rcbuffer->pybuffer);
14686  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmt.rcbuffer->pybuffer);
14687  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
14688  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
14689  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer);
14690  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
14691  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
14692  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
14693  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
14694  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
14695  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
14696  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
14697  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
14698  __pyx_L2:;
14699  __Pyx_XDECREF(__pyx_v_q);
14700  __Pyx_XDECREF((PyObject *)__pyx_v_a_up);
14701  __Pyx_XDECREF((PyObject *)__pyx_v_f_up);
14702  __Pyx_XGIVEREF(__pyx_r);
14703  __Pyx_RefNannyFinishContext();
14704  return __pyx_r;
14705 }
14706 
14707 /* "subsurfaceTransportFunctions.pyx":673
14708  * ##################################################
14709  *
14710  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
14711  * numpy.ndarray[DTYPE_t,ndim=3] w,
14712  * numpy.ndarray[DTYPE_t,ndim=2] dV,
14713  */
14714 
14715 /* Python wrapper */
14716 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_37updateMass_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
14717 static char __pyx_doc_28subsurfaceTransportFunctions_36updateMass_weakAvg[] = "\n approximate element mass term as (\010ar{c}_e,w_{h,i})_e\n ";
14718 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_37updateMass_weakAvg = {"updateMass_weakAvg", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_37updateMass_weakAvg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_36updateMass_weakAvg};
14719 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_37updateMass_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
14720  PyArrayObject *__pyx_v_mt = 0;
14721  PyArrayObject *__pyx_v_w = 0;
14722  PyArrayObject *__pyx_v_dV = 0;
14723  PyArrayObject *__pyx_v_weak_residual = 0;
14724  PyObject *__pyx_r = 0;
14725  __Pyx_RefNannyDeclarations
14726  __Pyx_RefNannySetupContext("updateMass_weakAvg (wrapper)", 0);
14727  {
14728  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mt,&__pyx_n_s_w,&__pyx_n_s_dV,&__pyx_n_s_weak_residual,0};
14729  PyObject* values[4] = {0,0,0,0};
14730  if (unlikely(__pyx_kwds)) {
14731  Py_ssize_t kw_args;
14732  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
14733  switch (pos_args) {
14734  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
14735  CYTHON_FALLTHROUGH;
14736  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
14737  CYTHON_FALLTHROUGH;
14738  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14739  CYTHON_FALLTHROUGH;
14740  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14741  CYTHON_FALLTHROUGH;
14742  case 0: break;
14743  default: goto __pyx_L5_argtuple_error;
14744  }
14745  kw_args = PyDict_Size(__pyx_kwds);
14746  switch (pos_args) {
14747  case 0:
14748  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mt)) != 0)) kw_args--;
14749  else goto __pyx_L5_argtuple_error;
14750  CYTHON_FALLTHROUGH;
14751  case 1:
14752  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
14753  else {
14754  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, 1); __PYX_ERR(0, 673, __pyx_L3_error)
14755  }
14756  CYTHON_FALLTHROUGH;
14757  case 2:
14758  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
14759  else {
14760  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, 2); __PYX_ERR(0, 673, __pyx_L3_error)
14761  }
14762  CYTHON_FALLTHROUGH;
14763  case 3:
14764  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_weak_residual)) != 0)) kw_args--;
14765  else {
14766  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, 3); __PYX_ERR(0, 673, __pyx_L3_error)
14767  }
14768  }
14769  if (unlikely(kw_args > 0)) {
14770  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateMass_weakAvg") < 0)) __PYX_ERR(0, 673, __pyx_L3_error)
14771  }
14772  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
14773  goto __pyx_L5_argtuple_error;
14774  } else {
14775  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14776  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14777  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
14778  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
14779  }
14780  __pyx_v_mt = ((PyArrayObject *)values[0]);
14781  __pyx_v_w = ((PyArrayObject *)values[1]);
14782  __pyx_v_dV = ((PyArrayObject *)values[2]);
14783  __pyx_v_weak_residual = ((PyArrayObject *)values[3]);
14784  }
14785  goto __pyx_L4_argument_unpacking_done;
14786  __pyx_L5_argtuple_error:;
14787  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 673, __pyx_L3_error)
14788  __pyx_L3_error:;
14789  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMass_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
14790  __Pyx_RefNannyFinishContext();
14791  return NULL;
14792  __pyx_L4_argument_unpacking_done:;
14793  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mt), __pyx_ptype_5numpy_ndarray, 1, "mt", 0))) __PYX_ERR(0, 673, __pyx_L1_error)
14794  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) __PYX_ERR(0, 674, __pyx_L1_error)
14795  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) __PYX_ERR(0, 675, __pyx_L1_error)
14796  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weak_residual), __pyx_ptype_5numpy_ndarray, 1, "weak_residual", 0))) __PYX_ERR(0, 676, __pyx_L1_error)
14797  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_36updateMass_weakAvg(__pyx_self, __pyx_v_mt, __pyx_v_w, __pyx_v_dV, __pyx_v_weak_residual);
14798 
14799  /* function exit code */
14800  goto __pyx_L0;
14801  __pyx_L1_error:;
14802  __pyx_r = NULL;
14803  __pyx_L0:;
14804  __Pyx_RefNannyFinishContext();
14805  return __pyx_r;
14806 }
14807 
14808 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_36updateMass_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_weak_residual) {
14809  int __pyx_v_eN;
14810  int __pyx_v_i;
14811  int __pyx_v_k;
14812  PyObject *__pyx_v_mt_avg = 0;
14813  PyObject *__pyx_v_vol = 0;
14814  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
14815  __Pyx_Buffer __pyx_pybuffer_dV;
14816  __Pyx_LocalBuf_ND __pyx_pybuffernd_mt;
14817  __Pyx_Buffer __pyx_pybuffer_mt;
14818  __Pyx_LocalBuf_ND __pyx_pybuffernd_w;
14819  __Pyx_Buffer __pyx_pybuffer_w;
14820  __Pyx_LocalBuf_ND __pyx_pybuffernd_weak_residual;
14821  __Pyx_Buffer __pyx_pybuffer_weak_residual;
14822  PyObject *__pyx_r = NULL;
14823  __Pyx_RefNannyDeclarations
14824  npy_intp __pyx_t_1;
14825  npy_intp __pyx_t_2;
14826  int __pyx_t_3;
14827  npy_intp __pyx_t_4;
14828  npy_intp __pyx_t_5;
14829  int __pyx_t_6;
14830  Py_ssize_t __pyx_t_7;
14831  Py_ssize_t __pyx_t_8;
14832  int __pyx_t_9;
14833  Py_ssize_t __pyx_t_10;
14834  Py_ssize_t __pyx_t_11;
14835  PyObject *__pyx_t_12 = NULL;
14836  PyObject *__pyx_t_13 = NULL;
14837  Py_ssize_t __pyx_t_14;
14838  Py_ssize_t __pyx_t_15;
14839  Py_ssize_t __pyx_t_16;
14840  Py_ssize_t __pyx_t_17;
14841  Py_ssize_t __pyx_t_18;
14842  Py_ssize_t __pyx_t_19;
14843  Py_ssize_t __pyx_t_20;
14844  PyObject *__pyx_t_21 = NULL;
14845  double __pyx_t_22;
14846  Py_ssize_t __pyx_t_23;
14847  Py_ssize_t __pyx_t_24;
14848  __Pyx_RefNannySetupContext("updateMass_weakAvg", 0);
14849  __pyx_pybuffer_mt.pybuffer.buf = NULL;
14850  __pyx_pybuffer_mt.refcount = 0;
14851  __pyx_pybuffernd_mt.data = NULL;
14852  __pyx_pybuffernd_mt.rcbuffer = &__pyx_pybuffer_mt;
14853  __pyx_pybuffer_w.pybuffer.buf = NULL;
14854  __pyx_pybuffer_w.refcount = 0;
14855  __pyx_pybuffernd_w.data = NULL;
14856  __pyx_pybuffernd_w.rcbuffer = &__pyx_pybuffer_w;
14857  __pyx_pybuffer_dV.pybuffer.buf = NULL;
14858  __pyx_pybuffer_dV.refcount = 0;
14859  __pyx_pybuffernd_dV.data = NULL;
14860  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
14861  __pyx_pybuffer_weak_residual.pybuffer.buf = NULL;
14862  __pyx_pybuffer_weak_residual.refcount = 0;
14863  __pyx_pybuffernd_weak_residual.data = NULL;
14864  __pyx_pybuffernd_weak_residual.rcbuffer = &__pyx_pybuffer_weak_residual;
14865  {
14866  __Pyx_BufFmt_StackElem __pyx_stack[1];
14867  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mt.rcbuffer->pybuffer, (PyObject*)__pyx_v_mt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 673, __pyx_L1_error)
14868  }
14869  __pyx_pybuffernd_mt.diminfo[0].strides = __pyx_pybuffernd_mt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mt.diminfo[0].shape = __pyx_pybuffernd_mt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mt.diminfo[1].strides = __pyx_pybuffernd_mt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mt.diminfo[1].shape = __pyx_pybuffernd_mt.rcbuffer->pybuffer.shape[1];
14870  {
14871  __Pyx_BufFmt_StackElem __pyx_stack[1];
14872  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 673, __pyx_L1_error)
14873  }
14874  __pyx_pybuffernd_w.diminfo[0].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w.diminfo[0].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_w.diminfo[1].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_w.diminfo[1].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_w.diminfo[2].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_w.diminfo[2].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[2];
14875  {
14876  __Pyx_BufFmt_StackElem __pyx_stack[1];
14877  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 673, __pyx_L1_error)
14878  }
14879  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
14880  {
14881  __Pyx_BufFmt_StackElem __pyx_stack[1];
14882  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weak_residual.rcbuffer->pybuffer, (PyObject*)__pyx_v_weak_residual, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 673, __pyx_L1_error)
14883  }
14884  __pyx_pybuffernd_weak_residual.diminfo[0].strides = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weak_residual.diminfo[0].shape = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_weak_residual.diminfo[1].strides = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_weak_residual.diminfo[1].shape = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.shape[1];
14885 
14886  /* "subsurfaceTransportFunctions.pyx":682
14887  * cdef int eN,i,k
14888  * cdef mt_avg,vol
14889  * for eN in range(mt.shape[0]): # <<<<<<<<<<<<<<
14890  * mt_avg = 0.0
14891  * vol = 0.0
14892  */
14893  __pyx_t_1 = (__pyx_v_mt->dimensions[0]);
14894  __pyx_t_2 = __pyx_t_1;
14895  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
14896  __pyx_v_eN = __pyx_t_3;
14897 
14898  /* "subsurfaceTransportFunctions.pyx":683
14899  * cdef mt_avg,vol
14900  * for eN in range(mt.shape[0]):
14901  * mt_avg = 0.0 # <<<<<<<<<<<<<<
14902  * vol = 0.0
14903  * for k in range(mt.shape[1]):
14904  */
14905  __Pyx_INCREF(__pyx_float_0_0);
14906  __Pyx_XDECREF_SET(__pyx_v_mt_avg, __pyx_float_0_0);
14907 
14908  /* "subsurfaceTransportFunctions.pyx":684
14909  * for eN in range(mt.shape[0]):
14910  * mt_avg = 0.0
14911  * vol = 0.0 # <<<<<<<<<<<<<<
14912  * for k in range(mt.shape[1]):
14913  * mt_avg += dV[eN,k]*mt[eN,k]
14914  */
14915  __Pyx_INCREF(__pyx_float_0_0);
14916  __Pyx_XDECREF_SET(__pyx_v_vol, __pyx_float_0_0);
14917 
14918  /* "subsurfaceTransportFunctions.pyx":685
14919  * mt_avg = 0.0
14920  * vol = 0.0
14921  * for k in range(mt.shape[1]): # <<<<<<<<<<<<<<
14922  * mt_avg += dV[eN,k]*mt[eN,k]
14923  * vol += dV[eN,k]
14924  */
14925  __pyx_t_4 = (__pyx_v_mt->dimensions[1]);
14926  __pyx_t_5 = __pyx_t_4;
14927  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
14928  __pyx_v_k = __pyx_t_6;
14929 
14930  /* "subsurfaceTransportFunctions.pyx":686
14931  * vol = 0.0
14932  * for k in range(mt.shape[1]):
14933  * mt_avg += dV[eN,k]*mt[eN,k] # <<<<<<<<<<<<<<
14934  * vol += dV[eN,k]
14935  * mt_avg /= vol
14936  */
14937  __pyx_t_7 = __pyx_v_eN;
14938  __pyx_t_8 = __pyx_v_k;
14939  __pyx_t_9 = -1;
14940  if (__pyx_t_7 < 0) {
14941  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[0].shape;
14942  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
14943  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
14944  if (__pyx_t_8 < 0) {
14945  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[1].shape;
14946  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
14947  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
14948  if (unlikely(__pyx_t_9 != -1)) {
14949  __Pyx_RaiseBufferIndexError(__pyx_t_9);
14950  __PYX_ERR(0, 686, __pyx_L1_error)
14951  }
14952  __pyx_t_10 = __pyx_v_eN;
14953  __pyx_t_11 = __pyx_v_k;
14954  __pyx_t_9 = -1;
14955  if (__pyx_t_10 < 0) {
14956  __pyx_t_10 += __pyx_pybuffernd_mt.diminfo[0].shape;
14957  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
14958  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_mt.diminfo[0].shape)) __pyx_t_9 = 0;
14959  if (__pyx_t_11 < 0) {
14960  __pyx_t_11 += __pyx_pybuffernd_mt.diminfo[1].shape;
14961  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
14962  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_mt.diminfo[1].shape)) __pyx_t_9 = 1;
14963  if (unlikely(__pyx_t_9 != -1)) {
14964  __Pyx_RaiseBufferIndexError(__pyx_t_9);
14965  __PYX_ERR(0, 686, __pyx_L1_error)
14966  }
14967  __pyx_t_12 = PyFloat_FromDouble(((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_mt.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_mt.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_mt.diminfo[1].strides)))); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 686, __pyx_L1_error)
14968  __Pyx_GOTREF(__pyx_t_12);
14969  __pyx_t_13 = PyNumber_InPlaceAdd(__pyx_v_mt_avg, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 686, __pyx_L1_error)
14970  __Pyx_GOTREF(__pyx_t_13);
14971  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
14972  __Pyx_DECREF_SET(__pyx_v_mt_avg, __pyx_t_13);
14973  __pyx_t_13 = 0;
14974 
14975  /* "subsurfaceTransportFunctions.pyx":687
14976  * for k in range(mt.shape[1]):
14977  * mt_avg += dV[eN,k]*mt[eN,k]
14978  * vol += dV[eN,k] # <<<<<<<<<<<<<<
14979  * mt_avg /= vol
14980  * for i in range(weak_residual.shape[1]):
14981  */
14982  __pyx_t_14 = __pyx_v_eN;
14983  __pyx_t_15 = __pyx_v_k;
14984  __pyx_t_9 = -1;
14985  if (__pyx_t_14 < 0) {
14986  __pyx_t_14 += __pyx_pybuffernd_dV.diminfo[0].shape;
14987  if (unlikely(__pyx_t_14 < 0)) __pyx_t_9 = 0;
14988  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
14989  if (__pyx_t_15 < 0) {
14990  __pyx_t_15 += __pyx_pybuffernd_dV.diminfo[1].shape;
14991  if (unlikely(__pyx_t_15 < 0)) __pyx_t_9 = 1;
14992  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
14993  if (unlikely(__pyx_t_9 != -1)) {
14994  __Pyx_RaiseBufferIndexError(__pyx_t_9);
14995  __PYX_ERR(0, 687, __pyx_L1_error)
14996  }
14997  __pyx_t_13 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_dV.diminfo[1].strides))); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 687, __pyx_L1_error)
14998  __Pyx_GOTREF(__pyx_t_13);
14999  __pyx_t_12 = PyNumber_InPlaceAdd(__pyx_v_vol, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 687, __pyx_L1_error)
15000  __Pyx_GOTREF(__pyx_t_12);
15001  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
15002  __Pyx_DECREF_SET(__pyx_v_vol, __pyx_t_12);
15003  __pyx_t_12 = 0;
15004  }
15005 
15006  /* "subsurfaceTransportFunctions.pyx":688
15007  * mt_avg += dV[eN,k]*mt[eN,k]
15008  * vol += dV[eN,k]
15009  * mt_avg /= vol # <<<<<<<<<<<<<<
15010  * for i in range(weak_residual.shape[1]):
15011  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
15012  */
15013  __pyx_t_12 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_mt_avg, __pyx_v_vol); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 688, __pyx_L1_error)
15014  __Pyx_GOTREF(__pyx_t_12);
15015  __Pyx_DECREF_SET(__pyx_v_mt_avg, __pyx_t_12);
15016  __pyx_t_12 = 0;
15017 
15018  /* "subsurfaceTransportFunctions.pyx":689
15019  * vol += dV[eN,k]
15020  * mt_avg /= vol
15021  * for i in range(weak_residual.shape[1]): # <<<<<<<<<<<<<<
15022  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
15023  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
15024  */
15025  __pyx_t_4 = (__pyx_v_weak_residual->dimensions[1]);
15026  __pyx_t_5 = __pyx_t_4;
15027  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
15028  __pyx_v_i = __pyx_t_6;
15029 
15030  /* "subsurfaceTransportFunctions.pyx":691
15031  * for i in range(weak_residual.shape[1]):
15032  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
15033  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k]) # <<<<<<<<<<<<<<
15034  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt,
15035  * numpy.ndarray[DTYPE_t,ndim=3] w,
15036  */
15037  __pyx_t_16 = __pyx_v_eN;
15038  __pyx_t_17 = __pyx_v_k;
15039  __pyx_t_18 = __pyx_v_i;
15040  __pyx_t_9 = -1;
15041  if (__pyx_t_16 < 0) {
15042  __pyx_t_16 += __pyx_pybuffernd_w.diminfo[0].shape;
15043  if (unlikely(__pyx_t_16 < 0)) __pyx_t_9 = 0;
15044  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_w.diminfo[0].shape)) __pyx_t_9 = 0;
15045  if (__pyx_t_17 < 0) {
15046  __pyx_t_17 += __pyx_pybuffernd_w.diminfo[1].shape;
15047  if (unlikely(__pyx_t_17 < 0)) __pyx_t_9 = 1;
15048  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_w.diminfo[1].shape)) __pyx_t_9 = 1;
15049  if (__pyx_t_18 < 0) {
15050  __pyx_t_18 += __pyx_pybuffernd_w.diminfo[2].shape;
15051  if (unlikely(__pyx_t_18 < 0)) __pyx_t_9 = 2;
15052  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_w.diminfo[2].shape)) __pyx_t_9 = 2;
15053  if (unlikely(__pyx_t_9 != -1)) {
15054  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15055  __PYX_ERR(0, 691, __pyx_L1_error)
15056  }
15057  __pyx_t_12 = PyFloat_FromDouble((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_w.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_w.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_w.diminfo[2].strides))); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 691, __pyx_L1_error)
15058  __Pyx_GOTREF(__pyx_t_12);
15059  __pyx_t_13 = PyNumber_Multiply(__pyx_v_mt_avg, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 691, __pyx_L1_error)
15060  __Pyx_GOTREF(__pyx_t_13);
15061  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
15062  __pyx_t_19 = __pyx_v_eN;
15063  __pyx_t_20 = __pyx_v_k;
15064  __pyx_t_9 = -1;
15065  if (__pyx_t_19 < 0) {
15066  __pyx_t_19 += __pyx_pybuffernd_dV.diminfo[0].shape;
15067  if (unlikely(__pyx_t_19 < 0)) __pyx_t_9 = 0;
15068  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
15069  if (__pyx_t_20 < 0) {
15070  __pyx_t_20 += __pyx_pybuffernd_dV.diminfo[1].shape;
15071  if (unlikely(__pyx_t_20 < 0)) __pyx_t_9 = 1;
15072  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
15073  if (unlikely(__pyx_t_9 != -1)) {
15074  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15075  __PYX_ERR(0, 691, __pyx_L1_error)
15076  }
15077  __pyx_t_12 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_dV.diminfo[1].strides))); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 691, __pyx_L1_error)
15078  __Pyx_GOTREF(__pyx_t_12);
15079  __pyx_t_21 = PyNumber_Multiply(__pyx_t_13, __pyx_t_12); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 691, __pyx_L1_error)
15080  __Pyx_GOTREF(__pyx_t_21);
15081  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
15082  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
15083  __pyx_t_22 = __Pyx_PyObject_AsDouble(__pyx_t_21); if (unlikely(__pyx_t_22 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L1_error)
15084  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
15085  __pyx_t_23 = __pyx_v_eN;
15086  __pyx_t_24 = __pyx_v_i;
15087  __pyx_t_9 = -1;
15088  if (__pyx_t_23 < 0) {
15089  __pyx_t_23 += __pyx_pybuffernd_weak_residual.diminfo[0].shape;
15090  if (unlikely(__pyx_t_23 < 0)) __pyx_t_9 = 0;
15091  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_weak_residual.diminfo[0].shape)) __pyx_t_9 = 0;
15092  if (__pyx_t_24 < 0) {
15093  __pyx_t_24 += __pyx_pybuffernd_weak_residual.diminfo[1].shape;
15094  if (unlikely(__pyx_t_24 < 0)) __pyx_t_9 = 1;
15095  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_weak_residual.diminfo[1].shape)) __pyx_t_9 = 1;
15096  if (unlikely(__pyx_t_9 != -1)) {
15097  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15098  __PYX_ERR(0, 691, __pyx_L1_error)
15099  }
15100  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_weak_residual.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_weak_residual.diminfo[1].strides) += __pyx_t_22;
15101  }
15102  }
15103 
15104  /* "subsurfaceTransportFunctions.pyx":673
15105  * ##################################################
15106  *
15107  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
15108  * numpy.ndarray[DTYPE_t,ndim=3] w,
15109  * numpy.ndarray[DTYPE_t,ndim=2] dV,
15110  */
15111 
15112  /* function exit code */
15113  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15114  goto __pyx_L0;
15115  __pyx_L1_error:;
15116  __Pyx_XDECREF(__pyx_t_12);
15117  __Pyx_XDECREF(__pyx_t_13);
15118  __Pyx_XDECREF(__pyx_t_21);
15119  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
15120  __Pyx_PyThreadState_declare
15121  __Pyx_PyThreadState_assign
15122  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
15123  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15124  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mt.rcbuffer->pybuffer);
15125  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
15126  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weak_residual.rcbuffer->pybuffer);
15127  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
15128  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMass_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
15129  __pyx_r = NULL;
15130  goto __pyx_L2;
15131  __pyx_L0:;
15132  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15133  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mt.rcbuffer->pybuffer);
15134  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
15135  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weak_residual.rcbuffer->pybuffer);
15136  __pyx_L2:;
15137  __Pyx_XDECREF(__pyx_v_mt_avg);
15138  __Pyx_XDECREF(__pyx_v_vol);
15139  __Pyx_XGIVEREF(__pyx_r);
15140  __Pyx_RefNannyFinishContext();
15141  return __pyx_r;
15142 }
15143 
15144 /* "subsurfaceTransportFunctions.pyx":692
15145  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
15146  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
15147  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
15148  * numpy.ndarray[DTYPE_t,ndim=3] w,
15149  * numpy.ndarray[DTYPE_t,ndim=3] v,
15150  */
15151 
15152 /* Python wrapper */
15153 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15154 static char __pyx_doc_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg[] = "\n approximate element mass Jacobian term as (\\pd{\010ar{c}_e}{u_j},w_{h,i})_e\n ";
15155 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg = {"updateMassJacobian_weakAvg", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg};
15156 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15157  PyArrayObject *__pyx_v_dmt = 0;
15158  PyArrayObject *__pyx_v_w = 0;
15159  PyArrayObject *__pyx_v_v = 0;
15160  PyArrayObject *__pyx_v_dV = 0;
15161  PyArrayObject *__pyx_v_jacobian_weak_residual = 0;
15162  PyObject *__pyx_r = 0;
15163  __Pyx_RefNannyDeclarations
15164  __Pyx_RefNannySetupContext("updateMassJacobian_weakAvg (wrapper)", 0);
15165  {
15166  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dmt,&__pyx_n_s_w,&__pyx_n_s_v,&__pyx_n_s_dV,&__pyx_n_s_jacobian_weak_residual,0};
15167  PyObject* values[5] = {0,0,0,0,0};
15168  if (unlikely(__pyx_kwds)) {
15169  Py_ssize_t kw_args;
15170  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15171  switch (pos_args) {
15172  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
15173  CYTHON_FALLTHROUGH;
15174  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15175  CYTHON_FALLTHROUGH;
15176  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15177  CYTHON_FALLTHROUGH;
15178  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15179  CYTHON_FALLTHROUGH;
15180  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15181  CYTHON_FALLTHROUGH;
15182  case 0: break;
15183  default: goto __pyx_L5_argtuple_error;
15184  }
15185  kw_args = PyDict_Size(__pyx_kwds);
15186  switch (pos_args) {
15187  case 0:
15188  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dmt)) != 0)) kw_args--;
15189  else goto __pyx_L5_argtuple_error;
15190  CYTHON_FALLTHROUGH;
15191  case 1:
15192  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
15193  else {
15194  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 1); __PYX_ERR(0, 692, __pyx_L3_error)
15195  }
15196  CYTHON_FALLTHROUGH;
15197  case 2:
15198  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
15199  else {
15200  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 2); __PYX_ERR(0, 692, __pyx_L3_error)
15201  }
15202  CYTHON_FALLTHROUGH;
15203  case 3:
15204  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
15205  else {
15206  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 3); __PYX_ERR(0, 692, __pyx_L3_error)
15207  }
15208  CYTHON_FALLTHROUGH;
15209  case 4:
15210  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_jacobian_weak_residual)) != 0)) kw_args--;
15211  else {
15212  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 4); __PYX_ERR(0, 692, __pyx_L3_error)
15213  }
15214  }
15215  if (unlikely(kw_args > 0)) {
15216  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateMassJacobian_weakAvg") < 0)) __PYX_ERR(0, 692, __pyx_L3_error)
15217  }
15218  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
15219  goto __pyx_L5_argtuple_error;
15220  } else {
15221  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15222  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15223  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15224  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15225  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
15226  }
15227  __pyx_v_dmt = ((PyArrayObject *)values[0]);
15228  __pyx_v_w = ((PyArrayObject *)values[1]);
15229  __pyx_v_v = ((PyArrayObject *)values[2]);
15230  __pyx_v_dV = ((PyArrayObject *)values[3]);
15231  __pyx_v_jacobian_weak_residual = ((PyArrayObject *)values[4]);
15232  }
15233  goto __pyx_L4_argument_unpacking_done;
15234  __pyx_L5_argtuple_error:;
15235  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 692, __pyx_L3_error)
15236  __pyx_L3_error:;
15237  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMassJacobian_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
15238  __Pyx_RefNannyFinishContext();
15239  return NULL;
15240  __pyx_L4_argument_unpacking_done:;
15241  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dmt), __pyx_ptype_5numpy_ndarray, 1, "dmt", 0))) __PYX_ERR(0, 692, __pyx_L1_error)
15242  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) __PYX_ERR(0, 693, __pyx_L1_error)
15243  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 694, __pyx_L1_error)
15244  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) __PYX_ERR(0, 695, __pyx_L1_error)
15245  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_jacobian_weak_residual), __pyx_ptype_5numpy_ndarray, 1, "jacobian_weak_residual", 0))) __PYX_ERR(0, 696, __pyx_L1_error)
15246  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg(__pyx_self, __pyx_v_dmt, __pyx_v_w, __pyx_v_v, __pyx_v_dV, __pyx_v_jacobian_weak_residual);
15247 
15248  /* function exit code */
15249  goto __pyx_L0;
15250  __pyx_L1_error:;
15251  __pyx_r = NULL;
15252  __pyx_L0:;
15253  __Pyx_RefNannyFinishContext();
15254  return __pyx_r;
15255 }
15256 
15257 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_dmt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_jacobian_weak_residual) {
15258  int __pyx_v_eN;
15259  int __pyx_v_i;
15260  int __pyx_v_j;
15261  int __pyx_v_k;
15262  double __pyx_v_dmtj_avg;
15263  double __pyx_v_vol;
15264  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
15265  __Pyx_Buffer __pyx_pybuffer_dV;
15266  __Pyx_LocalBuf_ND __pyx_pybuffernd_dmt;
15267  __Pyx_Buffer __pyx_pybuffer_dmt;
15268  __Pyx_LocalBuf_ND __pyx_pybuffernd_jacobian_weak_residual;
15269  __Pyx_Buffer __pyx_pybuffer_jacobian_weak_residual;
15270  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
15271  __Pyx_Buffer __pyx_pybuffer_v;
15272  __Pyx_LocalBuf_ND __pyx_pybuffernd_w;
15273  __Pyx_Buffer __pyx_pybuffer_w;
15274  PyObject *__pyx_r = NULL;
15275  __Pyx_RefNannyDeclarations
15276  npy_intp __pyx_t_1;
15277  npy_intp __pyx_t_2;
15278  int __pyx_t_3;
15279  npy_intp __pyx_t_4;
15280  npy_intp __pyx_t_5;
15281  int __pyx_t_6;
15282  Py_ssize_t __pyx_t_7;
15283  Py_ssize_t __pyx_t_8;
15284  int __pyx_t_9;
15285  npy_intp __pyx_t_10;
15286  npy_intp __pyx_t_11;
15287  npy_intp __pyx_t_12;
15288  npy_intp __pyx_t_13;
15289  int __pyx_t_14;
15290  Py_ssize_t __pyx_t_15;
15291  Py_ssize_t __pyx_t_16;
15292  int __pyx_t_17;
15293  Py_ssize_t __pyx_t_18;
15294  Py_ssize_t __pyx_t_19;
15295  Py_ssize_t __pyx_t_20;
15296  Py_ssize_t __pyx_t_21;
15297  Py_ssize_t __pyx_t_22;
15298  Py_ssize_t __pyx_t_23;
15299  Py_ssize_t __pyx_t_24;
15300  Py_ssize_t __pyx_t_25;
15301  Py_ssize_t __pyx_t_26;
15302  Py_ssize_t __pyx_t_27;
15303  Py_ssize_t __pyx_t_28;
15304  Py_ssize_t __pyx_t_29;
15305  Py_ssize_t __pyx_t_30;
15306  __Pyx_RefNannySetupContext("updateMassJacobian_weakAvg", 0);
15307  __pyx_pybuffer_dmt.pybuffer.buf = NULL;
15308  __pyx_pybuffer_dmt.refcount = 0;
15309  __pyx_pybuffernd_dmt.data = NULL;
15310  __pyx_pybuffernd_dmt.rcbuffer = &__pyx_pybuffer_dmt;
15311  __pyx_pybuffer_w.pybuffer.buf = NULL;
15312  __pyx_pybuffer_w.refcount = 0;
15313  __pyx_pybuffernd_w.data = NULL;
15314  __pyx_pybuffernd_w.rcbuffer = &__pyx_pybuffer_w;
15315  __pyx_pybuffer_v.pybuffer.buf = NULL;
15316  __pyx_pybuffer_v.refcount = 0;
15317  __pyx_pybuffernd_v.data = NULL;
15318  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
15319  __pyx_pybuffer_dV.pybuffer.buf = NULL;
15320  __pyx_pybuffer_dV.refcount = 0;
15321  __pyx_pybuffernd_dV.data = NULL;
15322  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
15323  __pyx_pybuffer_jacobian_weak_residual.pybuffer.buf = NULL;
15324  __pyx_pybuffer_jacobian_weak_residual.refcount = 0;
15325  __pyx_pybuffernd_jacobian_weak_residual.data = NULL;
15326  __pyx_pybuffernd_jacobian_weak_residual.rcbuffer = &__pyx_pybuffer_jacobian_weak_residual;
15327  {
15328  __Pyx_BufFmt_StackElem __pyx_stack[1];
15329  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dmt.rcbuffer->pybuffer, (PyObject*)__pyx_v_dmt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
15330  }
15331  __pyx_pybuffernd_dmt.diminfo[0].strides = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dmt.diminfo[0].shape = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dmt.diminfo[1].strides = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dmt.diminfo[1].shape = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.shape[1];
15332  {
15333  __Pyx_BufFmt_StackElem __pyx_stack[1];
15334  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
15335  }
15336  __pyx_pybuffernd_w.diminfo[0].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w.diminfo[0].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_w.diminfo[1].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_w.diminfo[1].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_w.diminfo[2].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_w.diminfo[2].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[2];
15337  {
15338  __Pyx_BufFmt_StackElem __pyx_stack[1];
15339  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
15340  }
15341  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
15342  {
15343  __Pyx_BufFmt_StackElem __pyx_stack[1];
15344  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
15345  }
15346  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
15347  {
15348  __Pyx_BufFmt_StackElem __pyx_stack[1];
15349  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer, (PyObject*)__pyx_v_jacobian_weak_residual, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
15350  }
15351  __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].strides = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].shape = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].strides = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].shape = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].strides = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].shape = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.shape[2];
15352 
15353  /* "subsurfaceTransportFunctions.pyx":702
15354  * cdef int eN,i,j,k
15355  * cdef double dmtj_avg,vol
15356  * for eN in range(dmt.shape[0]): # <<<<<<<<<<<<<<
15357  * vol = 0.0 #should I save a loop?
15358  * for k in range(dmt.shape[1]):
15359  */
15360  __pyx_t_1 = (__pyx_v_dmt->dimensions[0]);
15361  __pyx_t_2 = __pyx_t_1;
15362  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
15363  __pyx_v_eN = __pyx_t_3;
15364 
15365  /* "subsurfaceTransportFunctions.pyx":703
15366  * cdef double dmtj_avg,vol
15367  * for eN in range(dmt.shape[0]):
15368  * vol = 0.0 #should I save a loop? # <<<<<<<<<<<<<<
15369  * for k in range(dmt.shape[1]):
15370  * vol += dV[eN,k]
15371  */
15372  __pyx_v_vol = 0.0;
15373 
15374  /* "subsurfaceTransportFunctions.pyx":704
15375  * for eN in range(dmt.shape[0]):
15376  * vol = 0.0 #should I save a loop?
15377  * for k in range(dmt.shape[1]): # <<<<<<<<<<<<<<
15378  * vol += dV[eN,k]
15379  * for i in range(w.shape[2]):
15380  */
15381  __pyx_t_4 = (__pyx_v_dmt->dimensions[1]);
15382  __pyx_t_5 = __pyx_t_4;
15383  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
15384  __pyx_v_k = __pyx_t_6;
15385 
15386  /* "subsurfaceTransportFunctions.pyx":705
15387  * vol = 0.0 #should I save a loop?
15388  * for k in range(dmt.shape[1]):
15389  * vol += dV[eN,k] # <<<<<<<<<<<<<<
15390  * for i in range(w.shape[2]):
15391  * for j in range(v.shape[2]):
15392  */
15393  __pyx_t_7 = __pyx_v_eN;
15394  __pyx_t_8 = __pyx_v_k;
15395  __pyx_t_9 = -1;
15396  if (__pyx_t_7 < 0) {
15397  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[0].shape;
15398  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
15399  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
15400  if (__pyx_t_8 < 0) {
15401  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[1].shape;
15402  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
15403  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
15404  if (unlikely(__pyx_t_9 != -1)) {
15405  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15406  __PYX_ERR(0, 705, __pyx_L1_error)
15407  }
15408  __pyx_v_vol = (__pyx_v_vol + (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[1].strides)));
15409  }
15410 
15411  /* "subsurfaceTransportFunctions.pyx":706
15412  * for k in range(dmt.shape[1]):
15413  * vol += dV[eN,k]
15414  * for i in range(w.shape[2]): # <<<<<<<<<<<<<<
15415  * for j in range(v.shape[2]):
15416  * dmtj_avg = 0.0
15417  */
15418  __pyx_t_4 = (__pyx_v_w->dimensions[2]);
15419  __pyx_t_5 = __pyx_t_4;
15420  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
15421  __pyx_v_i = __pyx_t_6;
15422 
15423  /* "subsurfaceTransportFunctions.pyx":707
15424  * vol += dV[eN,k]
15425  * for i in range(w.shape[2]):
15426  * for j in range(v.shape[2]): # <<<<<<<<<<<<<<
15427  * dmtj_avg = 0.0
15428  * for k in range(dmt.shape[1]):
15429  */
15430  __pyx_t_10 = (__pyx_v_v->dimensions[2]);
15431  __pyx_t_11 = __pyx_t_10;
15432  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_11; __pyx_t_9+=1) {
15433  __pyx_v_j = __pyx_t_9;
15434 
15435  /* "subsurfaceTransportFunctions.pyx":708
15436  * for i in range(w.shape[2]):
15437  * for j in range(v.shape[2]):
15438  * dmtj_avg = 0.0 # <<<<<<<<<<<<<<
15439  * for k in range(dmt.shape[1]):
15440  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
15441  */
15442  __pyx_v_dmtj_avg = 0.0;
15443 
15444  /* "subsurfaceTransportFunctions.pyx":709
15445  * for j in range(v.shape[2]):
15446  * dmtj_avg = 0.0
15447  * for k in range(dmt.shape[1]): # <<<<<<<<<<<<<<
15448  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
15449  * dmtj_avg /= vol
15450  */
15451  __pyx_t_12 = (__pyx_v_dmt->dimensions[1]);
15452  __pyx_t_13 = __pyx_t_12;
15453  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
15454  __pyx_v_k = __pyx_t_14;
15455 
15456  /* "subsurfaceTransportFunctions.pyx":710
15457  * dmtj_avg = 0.0
15458  * for k in range(dmt.shape[1]):
15459  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j] # <<<<<<<<<<<<<<
15460  * dmtj_avg /= vol
15461  * jacobian_weak_residual[eN,i,j] += dmtj_avg*w[eN,k,i]*dV[eN,k]
15462  */
15463  __pyx_t_15 = __pyx_v_eN;
15464  __pyx_t_16 = __pyx_v_k;
15465  __pyx_t_17 = -1;
15466  if (__pyx_t_15 < 0) {
15467  __pyx_t_15 += __pyx_pybuffernd_dV.diminfo[0].shape;
15468  if (unlikely(__pyx_t_15 < 0)) __pyx_t_17 = 0;
15469  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_17 = 0;
15470  if (__pyx_t_16 < 0) {
15471  __pyx_t_16 += __pyx_pybuffernd_dV.diminfo[1].shape;
15472  if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 1;
15473  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_17 = 1;
15474  if (unlikely(__pyx_t_17 != -1)) {
15475  __Pyx_RaiseBufferIndexError(__pyx_t_17);
15476  __PYX_ERR(0, 710, __pyx_L1_error)
15477  }
15478  __pyx_t_18 = __pyx_v_eN;
15479  __pyx_t_19 = __pyx_v_k;
15480  __pyx_t_17 = -1;
15481  if (__pyx_t_18 < 0) {
15482  __pyx_t_18 += __pyx_pybuffernd_dmt.diminfo[0].shape;
15483  if (unlikely(__pyx_t_18 < 0)) __pyx_t_17 = 0;
15484  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_dmt.diminfo[0].shape)) __pyx_t_17 = 0;
15485  if (__pyx_t_19 < 0) {
15486  __pyx_t_19 += __pyx_pybuffernd_dmt.diminfo[1].shape;
15487  if (unlikely(__pyx_t_19 < 0)) __pyx_t_17 = 1;
15488  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_dmt.diminfo[1].shape)) __pyx_t_17 = 1;
15489  if (unlikely(__pyx_t_17 != -1)) {
15490  __Pyx_RaiseBufferIndexError(__pyx_t_17);
15491  __PYX_ERR(0, 710, __pyx_L1_error)
15492  }
15493  __pyx_t_20 = __pyx_v_eN;
15494  __pyx_t_21 = __pyx_v_k;
15495  __pyx_t_22 = __pyx_v_j;
15496  __pyx_t_17 = -1;
15497  if (__pyx_t_20 < 0) {
15498  __pyx_t_20 += __pyx_pybuffernd_v.diminfo[0].shape;
15499  if (unlikely(__pyx_t_20 < 0)) __pyx_t_17 = 0;
15500  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_17 = 0;
15501  if (__pyx_t_21 < 0) {
15502  __pyx_t_21 += __pyx_pybuffernd_v.diminfo[1].shape;
15503  if (unlikely(__pyx_t_21 < 0)) __pyx_t_17 = 1;
15504  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_17 = 1;
15505  if (__pyx_t_22 < 0) {
15506  __pyx_t_22 += __pyx_pybuffernd_v.diminfo[2].shape;
15507  if (unlikely(__pyx_t_22 < 0)) __pyx_t_17 = 2;
15508  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_17 = 2;
15509  if (unlikely(__pyx_t_17 != -1)) {
15510  __Pyx_RaiseBufferIndexError(__pyx_t_17);
15511  __PYX_ERR(0, 710, __pyx_L1_error)
15512  }
15513  __pyx_v_dmtj_avg = (__pyx_v_dmtj_avg + (((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dmt.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_dmt.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_dmt.diminfo[1].strides))) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_22, __pyx_pybuffernd_v.diminfo[2].strides))));
15514  }
15515 
15516  /* "subsurfaceTransportFunctions.pyx":711
15517  * for k in range(dmt.shape[1]):
15518  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
15519  * dmtj_avg /= vol # <<<<<<<<<<<<<<
15520  * jacobian_weak_residual[eN,i,j] += dmtj_avg*w[eN,k,i]*dV[eN,k]
15521  *
15522  */
15523  if (unlikely(__pyx_v_vol == 0)) {
15524  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
15525  __PYX_ERR(0, 711, __pyx_L1_error)
15526  }
15527  __pyx_v_dmtj_avg = (__pyx_v_dmtj_avg / __pyx_v_vol);
15528 
15529  /* "subsurfaceTransportFunctions.pyx":712
15530  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
15531  * dmtj_avg /= vol
15532  * jacobian_weak_residual[eN,i,j] += dmtj_avg*w[eN,k,i]*dV[eN,k] # <<<<<<<<<<<<<<
15533  *
15534  * ########################################################################
15535  */
15536  __pyx_t_23 = __pyx_v_eN;
15537  __pyx_t_24 = __pyx_v_k;
15538  __pyx_t_25 = __pyx_v_i;
15539  __pyx_t_14 = -1;
15540  if (__pyx_t_23 < 0) {
15541  __pyx_t_23 += __pyx_pybuffernd_w.diminfo[0].shape;
15542  if (unlikely(__pyx_t_23 < 0)) __pyx_t_14 = 0;
15543  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_w.diminfo[0].shape)) __pyx_t_14 = 0;
15544  if (__pyx_t_24 < 0) {
15545  __pyx_t_24 += __pyx_pybuffernd_w.diminfo[1].shape;
15546  if (unlikely(__pyx_t_24 < 0)) __pyx_t_14 = 1;
15547  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_w.diminfo[1].shape)) __pyx_t_14 = 1;
15548  if (__pyx_t_25 < 0) {
15549  __pyx_t_25 += __pyx_pybuffernd_w.diminfo[2].shape;
15550  if (unlikely(__pyx_t_25 < 0)) __pyx_t_14 = 2;
15551  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_w.diminfo[2].shape)) __pyx_t_14 = 2;
15552  if (unlikely(__pyx_t_14 != -1)) {
15553  __Pyx_RaiseBufferIndexError(__pyx_t_14);
15554  __PYX_ERR(0, 712, __pyx_L1_error)
15555  }
15556  __pyx_t_26 = __pyx_v_eN;
15557  __pyx_t_27 = __pyx_v_k;
15558  __pyx_t_14 = -1;
15559  if (__pyx_t_26 < 0) {
15560  __pyx_t_26 += __pyx_pybuffernd_dV.diminfo[0].shape;
15561  if (unlikely(__pyx_t_26 < 0)) __pyx_t_14 = 0;
15562  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_14 = 0;
15563  if (__pyx_t_27 < 0) {
15564  __pyx_t_27 += __pyx_pybuffernd_dV.diminfo[1].shape;
15565  if (unlikely(__pyx_t_27 < 0)) __pyx_t_14 = 1;
15566  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_14 = 1;
15567  if (unlikely(__pyx_t_14 != -1)) {
15568  __Pyx_RaiseBufferIndexError(__pyx_t_14);
15569  __PYX_ERR(0, 712, __pyx_L1_error)
15570  }
15571  __pyx_t_28 = __pyx_v_eN;
15572  __pyx_t_29 = __pyx_v_i;
15573  __pyx_t_30 = __pyx_v_j;
15574  __pyx_t_14 = -1;
15575  if (__pyx_t_28 < 0) {
15576  __pyx_t_28 += __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].shape;
15577  if (unlikely(__pyx_t_28 < 0)) __pyx_t_14 = 0;
15578  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].shape)) __pyx_t_14 = 0;
15579  if (__pyx_t_29 < 0) {
15580  __pyx_t_29 += __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].shape;
15581  if (unlikely(__pyx_t_29 < 0)) __pyx_t_14 = 1;
15582  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].shape)) __pyx_t_14 = 1;
15583  if (__pyx_t_30 < 0) {
15584  __pyx_t_30 += __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].shape;
15585  if (unlikely(__pyx_t_30 < 0)) __pyx_t_14 = 2;
15586  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].shape)) __pyx_t_14 = 2;
15587  if (unlikely(__pyx_t_14 != -1)) {
15588  __Pyx_RaiseBufferIndexError(__pyx_t_14);
15589  __PYX_ERR(0, 712, __pyx_L1_error)
15590  }
15591  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].strides, __pyx_t_30, __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].strides) += ((__pyx_v_dmtj_avg * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_w.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_w.diminfo[1].strides, __pyx_t_25, __pyx_pybuffernd_w.diminfo[2].strides))) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_dV.diminfo[1].strides)));
15592  }
15593  }
15594  }
15595 
15596  /* "subsurfaceTransportFunctions.pyx":692
15597  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
15598  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
15599  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
15600  * numpy.ndarray[DTYPE_t,ndim=3] w,
15601  * numpy.ndarray[DTYPE_t,ndim=3] v,
15602  */
15603 
15604  /* function exit code */
15605  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15606  goto __pyx_L0;
15607  __pyx_L1_error:;
15608  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
15609  __Pyx_PyThreadState_declare
15610  __Pyx_PyThreadState_assign
15611  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
15612  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15613  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dmt.rcbuffer->pybuffer);
15614  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer);
15615  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
15616  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
15617  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
15618  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMassJacobian_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
15619  __pyx_r = NULL;
15620  goto __pyx_L2;
15621  __pyx_L0:;
15622  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15623  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dmt.rcbuffer->pybuffer);
15624  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer);
15625  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
15626  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
15627  __pyx_L2:;
15628  __Pyx_XGIVEREF(__pyx_r);
15629  __Pyx_RefNannyFinishContext();
15630  return __pyx_r;
15631 }
15632 
15633 /* "subsurfaceTransportFunctions.pyx":717
15634  * #ELLAM
15635  * ########################################################################
15636  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
15637  * numpy.ndarray[DTYPE_t,ndim=4] n,
15638  * numpy.ndarray[DTYPE_t,ndim=3] dS,
15639  */
15640 
15641 /* Python wrapper */
15642 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_41calculateNormalFlux(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15643 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_41calculateNormalFlux = {"calculateNormalFlux", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_41calculateNormalFlux, METH_VARARGS|METH_KEYWORDS, 0};
15644 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_41calculateNormalFlux(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15645  PyArrayObject *__pyx_v_v = 0;
15646  PyArrayObject *__pyx_v_n = 0;
15647  PyArrayObject *__pyx_v_dS = 0;
15648  PyArrayObject *__pyx_v_flux = 0;
15649  PyObject *__pyx_r = 0;
15650  __Pyx_RefNannyDeclarations
15651  __Pyx_RefNannySetupContext("calculateNormalFlux (wrapper)", 0);
15652  {
15653  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,&__pyx_n_s_n,&__pyx_n_s_dS,&__pyx_n_s_flux,0};
15654  PyObject* values[4] = {0,0,0,0};
15655  if (unlikely(__pyx_kwds)) {
15656  Py_ssize_t kw_args;
15657  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15658  switch (pos_args) {
15659  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15660  CYTHON_FALLTHROUGH;
15661  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15662  CYTHON_FALLTHROUGH;
15663  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15664  CYTHON_FALLTHROUGH;
15665  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15666  CYTHON_FALLTHROUGH;
15667  case 0: break;
15668  default: goto __pyx_L5_argtuple_error;
15669  }
15670  kw_args = PyDict_Size(__pyx_kwds);
15671  switch (pos_args) {
15672  case 0:
15673  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
15674  else goto __pyx_L5_argtuple_error;
15675  CYTHON_FALLTHROUGH;
15676  case 1:
15677  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
15678  else {
15679  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, 1); __PYX_ERR(0, 717, __pyx_L3_error)
15680  }
15681  CYTHON_FALLTHROUGH;
15682  case 2:
15683  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dS)) != 0)) kw_args--;
15684  else {
15685  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, 2); __PYX_ERR(0, 717, __pyx_L3_error)
15686  }
15687  CYTHON_FALLTHROUGH;
15688  case 3:
15689  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flux)) != 0)) kw_args--;
15690  else {
15691  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, 3); __PYX_ERR(0, 717, __pyx_L3_error)
15692  }
15693  }
15694  if (unlikely(kw_args > 0)) {
15695  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calculateNormalFlux") < 0)) __PYX_ERR(0, 717, __pyx_L3_error)
15696  }
15697  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
15698  goto __pyx_L5_argtuple_error;
15699  } else {
15700  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15701  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15702  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15703  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15704  }
15705  __pyx_v_v = ((PyArrayObject *)values[0]);
15706  __pyx_v_n = ((PyArrayObject *)values[1]);
15707  __pyx_v_dS = ((PyArrayObject *)values[2]);
15708  __pyx_v_flux = ((PyArrayObject *)values[3]);
15709  }
15710  goto __pyx_L4_argument_unpacking_done;
15711  __pyx_L5_argtuple_error:;
15712  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 717, __pyx_L3_error)
15713  __pyx_L3_error:;
15714  __Pyx_AddTraceback("subsurfaceTransportFunctions.calculateNormalFlux", __pyx_clineno, __pyx_lineno, __pyx_filename);
15715  __Pyx_RefNannyFinishContext();
15716  return NULL;
15717  __pyx_L4_argument_unpacking_done:;
15718  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 717, __pyx_L1_error)
15719  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n), __pyx_ptype_5numpy_ndarray, 1, "n", 0))) __PYX_ERR(0, 718, __pyx_L1_error)
15720  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dS), __pyx_ptype_5numpy_ndarray, 1, "dS", 0))) __PYX_ERR(0, 719, __pyx_L1_error)
15721  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_flux), __pyx_ptype_5numpy_ndarray, 1, "flux", 0))) __PYX_ERR(0, 720, __pyx_L1_error)
15722  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_40calculateNormalFlux(__pyx_self, __pyx_v_v, __pyx_v_n, __pyx_v_dS, __pyx_v_flux);
15723 
15724  /* function exit code */
15725  goto __pyx_L0;
15726  __pyx_L1_error:;
15727  __pyx_r = NULL;
15728  __pyx_L0:;
15729  __Pyx_RefNannyFinishContext();
15730  return __pyx_r;
15731 }
15732 
15733 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_40calculateNormalFlux(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_dS, PyArrayObject *__pyx_v_flux) {
15734  int __pyx_v_eN;
15735  int __pyx_v_ebN;
15736  int __pyx_v_kb;
15737  double __pyx_v_integral;
15738  npy_intp __pyx_v_I;
15739  __Pyx_LocalBuf_ND __pyx_pybuffernd_dS;
15740  __Pyx_Buffer __pyx_pybuffer_dS;
15741  __Pyx_LocalBuf_ND __pyx_pybuffernd_flux;
15742  __Pyx_Buffer __pyx_pybuffer_flux;
15743  __Pyx_LocalBuf_ND __pyx_pybuffernd_n;
15744  __Pyx_Buffer __pyx_pybuffer_n;
15745  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
15746  __Pyx_Buffer __pyx_pybuffer_v;
15747  PyObject *__pyx_r = NULL;
15748  __Pyx_RefNannyDeclarations
15749  npy_intp __pyx_t_1;
15750  npy_intp __pyx_t_2;
15751  int __pyx_t_3;
15752  npy_intp __pyx_t_4;
15753  npy_intp __pyx_t_5;
15754  int __pyx_t_6;
15755  npy_intp __pyx_t_7;
15756  npy_intp __pyx_t_8;
15757  int __pyx_t_9;
15758  npy_intp __pyx_t_10;
15759  npy_intp __pyx_t_11;
15760  npy_intp __pyx_t_12;
15761  Py_ssize_t __pyx_t_13;
15762  Py_ssize_t __pyx_t_14;
15763  Py_ssize_t __pyx_t_15;
15764  Py_ssize_t __pyx_t_16;
15765  int __pyx_t_17;
15766  Py_ssize_t __pyx_t_18;
15767  Py_ssize_t __pyx_t_19;
15768  Py_ssize_t __pyx_t_20;
15769  Py_ssize_t __pyx_t_21;
15770  Py_ssize_t __pyx_t_22;
15771  Py_ssize_t __pyx_t_23;
15772  Py_ssize_t __pyx_t_24;
15773  Py_ssize_t __pyx_t_25;
15774  Py_ssize_t __pyx_t_26;
15775  __Pyx_RefNannySetupContext("calculateNormalFlux", 0);
15776  __pyx_pybuffer_v.pybuffer.buf = NULL;
15777  __pyx_pybuffer_v.refcount = 0;
15778  __pyx_pybuffernd_v.data = NULL;
15779  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
15780  __pyx_pybuffer_n.pybuffer.buf = NULL;
15781  __pyx_pybuffer_n.refcount = 0;
15782  __pyx_pybuffernd_n.data = NULL;
15783  __pyx_pybuffernd_n.rcbuffer = &__pyx_pybuffer_n;
15784  __pyx_pybuffer_dS.pybuffer.buf = NULL;
15785  __pyx_pybuffer_dS.refcount = 0;
15786  __pyx_pybuffernd_dS.data = NULL;
15787  __pyx_pybuffernd_dS.rcbuffer = &__pyx_pybuffer_dS;
15788  __pyx_pybuffer_flux.pybuffer.buf = NULL;
15789  __pyx_pybuffer_flux.refcount = 0;
15790  __pyx_pybuffernd_flux.data = NULL;
15791  __pyx_pybuffernd_flux.rcbuffer = &__pyx_pybuffer_flux;
15792  {
15793  __Pyx_BufFmt_StackElem __pyx_stack[1];
15794  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 717, __pyx_L1_error)
15795  }
15796  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
15797  {
15798  __Pyx_BufFmt_StackElem __pyx_stack[1];
15799  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_n, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 717, __pyx_L1_error)
15800  }
15801  __pyx_pybuffernd_n.diminfo[0].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_n.diminfo[0].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_n.diminfo[1].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_n.diminfo[1].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_n.diminfo[2].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_n.diminfo[2].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_n.diminfo[3].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_n.diminfo[3].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[3];
15802  {
15803  __Pyx_BufFmt_StackElem __pyx_stack[1];
15804  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_v_dS, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 717, __pyx_L1_error)
15805  }
15806  __pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dS.diminfo[1].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dS.diminfo[1].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_dS.diminfo[2].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_dS.diminfo[2].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[2];
15807  {
15808  __Pyx_BufFmt_StackElem __pyx_stack[1];
15809  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_flux.rcbuffer->pybuffer, (PyObject*)__pyx_v_flux, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 717, __pyx_L1_error)
15810  }
15811  __pyx_pybuffernd_flux.diminfo[0].strides = __pyx_pybuffernd_flux.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_flux.diminfo[0].shape = __pyx_pybuffernd_flux.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_flux.diminfo[1].strides = __pyx_pybuffernd_flux.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_flux.diminfo[1].shape = __pyx_pybuffernd_flux.rcbuffer->pybuffer.shape[1];
15812 
15813  /* "subsurfaceTransportFunctions.pyx":724
15814  * cdef int eN,ebN,kb
15815  * cdef double integral
15816  * for eN in range(n.shape[0]): # <<<<<<<<<<<<<<
15817  * for ebN in range(n.shape[1]):
15818  * integral = 0.0
15819  */
15820  __pyx_t_1 = (__pyx_v_n->dimensions[0]);
15821  __pyx_t_2 = __pyx_t_1;
15822  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
15823  __pyx_v_eN = __pyx_t_3;
15824 
15825  /* "subsurfaceTransportFunctions.pyx":725
15826  * cdef double integral
15827  * for eN in range(n.shape[0]):
15828  * for ebN in range(n.shape[1]): # <<<<<<<<<<<<<<
15829  * integral = 0.0
15830  * for kb in range(n.shape[2]):
15831  */
15832  __pyx_t_4 = (__pyx_v_n->dimensions[1]);
15833  __pyx_t_5 = __pyx_t_4;
15834  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
15835  __pyx_v_ebN = __pyx_t_6;
15836 
15837  /* "subsurfaceTransportFunctions.pyx":726
15838  * for eN in range(n.shape[0]):
15839  * for ebN in range(n.shape[1]):
15840  * integral = 0.0 # <<<<<<<<<<<<<<
15841  * for kb in range(n.shape[2]):
15842  * for I in range(n.shape[3]):
15843  */
15844  __pyx_v_integral = 0.0;
15845 
15846  /* "subsurfaceTransportFunctions.pyx":727
15847  * for ebN in range(n.shape[1]):
15848  * integral = 0.0
15849  * for kb in range(n.shape[2]): # <<<<<<<<<<<<<<
15850  * for I in range(n.shape[3]):
15851  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb]
15852  */
15853  __pyx_t_7 = (__pyx_v_n->dimensions[2]);
15854  __pyx_t_8 = __pyx_t_7;
15855  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
15856  __pyx_v_kb = __pyx_t_9;
15857 
15858  /* "subsurfaceTransportFunctions.pyx":728
15859  * integral = 0.0
15860  * for kb in range(n.shape[2]):
15861  * for I in range(n.shape[3]): # <<<<<<<<<<<<<<
15862  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb]
15863  * flux[eN,ebN] = integral
15864  */
15865  __pyx_t_10 = (__pyx_v_n->dimensions[3]);
15866  __pyx_t_11 = __pyx_t_10;
15867  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
15868  __pyx_v_I = __pyx_t_12;
15869 
15870  /* "subsurfaceTransportFunctions.pyx":729
15871  * for kb in range(n.shape[2]):
15872  * for I in range(n.shape[3]):
15873  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb] # <<<<<<<<<<<<<<
15874  * flux[eN,ebN] = integral
15875  *
15876  */
15877  __pyx_t_13 = __pyx_v_eN;
15878  __pyx_t_14 = __pyx_v_ebN;
15879  __pyx_t_15 = __pyx_v_kb;
15880  __pyx_t_16 = __pyx_v_I;
15881  __pyx_t_17 = -1;
15882  if (__pyx_t_13 < 0) {
15883  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[0].shape;
15884  if (unlikely(__pyx_t_13 < 0)) __pyx_t_17 = 0;
15885  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_17 = 0;
15886  if (__pyx_t_14 < 0) {
15887  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[1].shape;
15888  if (unlikely(__pyx_t_14 < 0)) __pyx_t_17 = 1;
15889  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_17 = 1;
15890  if (__pyx_t_15 < 0) {
15891  __pyx_t_15 += __pyx_pybuffernd_v.diminfo[2].shape;
15892  if (unlikely(__pyx_t_15 < 0)) __pyx_t_17 = 2;
15893  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_17 = 2;
15894  if (__pyx_t_16 < 0) {
15895  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
15896  if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 3;
15897  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_17 = 3;
15898  if (unlikely(__pyx_t_17 != -1)) {
15899  __Pyx_RaiseBufferIndexError(__pyx_t_17);
15900  __PYX_ERR(0, 729, __pyx_L1_error)
15901  }
15902  __pyx_t_18 = __pyx_v_eN;
15903  __pyx_t_19 = __pyx_v_ebN;
15904  __pyx_t_20 = __pyx_v_kb;
15905  __pyx_t_21 = __pyx_v_I;
15906  __pyx_t_17 = -1;
15907  if (__pyx_t_18 < 0) {
15908  __pyx_t_18 += __pyx_pybuffernd_n.diminfo[0].shape;
15909  if (unlikely(__pyx_t_18 < 0)) __pyx_t_17 = 0;
15910  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_17 = 0;
15911  if (__pyx_t_19 < 0) {
15912  __pyx_t_19 += __pyx_pybuffernd_n.diminfo[1].shape;
15913  if (unlikely(__pyx_t_19 < 0)) __pyx_t_17 = 1;
15914  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_n.diminfo[1].shape)) __pyx_t_17 = 1;
15915  if (__pyx_t_20 < 0) {
15916  __pyx_t_20 += __pyx_pybuffernd_n.diminfo[2].shape;
15917  if (unlikely(__pyx_t_20 < 0)) __pyx_t_17 = 2;
15918  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_n.diminfo[2].shape)) __pyx_t_17 = 2;
15919  if (__pyx_t_21 < 0) {
15920  __pyx_t_21 += __pyx_pybuffernd_n.diminfo[3].shape;
15921  if (unlikely(__pyx_t_21 < 0)) __pyx_t_17 = 3;
15922  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_n.diminfo[3].shape)) __pyx_t_17 = 3;
15923  if (unlikely(__pyx_t_17 != -1)) {
15924  __Pyx_RaiseBufferIndexError(__pyx_t_17);
15925  __PYX_ERR(0, 729, __pyx_L1_error)
15926  }
15927  __pyx_t_22 = __pyx_v_eN;
15928  __pyx_t_23 = __pyx_v_ebN;
15929  __pyx_t_24 = __pyx_v_kb;
15930  __pyx_t_17 = -1;
15931  if (__pyx_t_22 < 0) {
15932  __pyx_t_22 += __pyx_pybuffernd_dS.diminfo[0].shape;
15933  if (unlikely(__pyx_t_22 < 0)) __pyx_t_17 = 0;
15934  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_dS.diminfo[0].shape)) __pyx_t_17 = 0;
15935  if (__pyx_t_23 < 0) {
15936  __pyx_t_23 += __pyx_pybuffernd_dS.diminfo[1].shape;
15937  if (unlikely(__pyx_t_23 < 0)) __pyx_t_17 = 1;
15938  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_dS.diminfo[1].shape)) __pyx_t_17 = 1;
15939  if (__pyx_t_24 < 0) {
15940  __pyx_t_24 += __pyx_pybuffernd_dS.diminfo[2].shape;
15941  if (unlikely(__pyx_t_24 < 0)) __pyx_t_17 = 2;
15942  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_dS.diminfo[2].shape)) __pyx_t_17 = 2;
15943  if (unlikely(__pyx_t_17 != -1)) {
15944  __Pyx_RaiseBufferIndexError(__pyx_t_17);
15945  __PYX_ERR(0, 729, __pyx_L1_error)
15946  }
15947  __pyx_v_integral = (__pyx_v_integral + (((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_15, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides)) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_n.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_n.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_n.diminfo[2].strides, __pyx_t_21, __pyx_pybuffernd_n.diminfo[3].strides))) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dS.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_dS.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_dS.diminfo[1].strides, __pyx_t_24, __pyx_pybuffernd_dS.diminfo[2].strides))));
15948  }
15949  }
15950 
15951  /* "subsurfaceTransportFunctions.pyx":730
15952  * for I in range(n.shape[3]):
15953  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb]
15954  * flux[eN,ebN] = integral # <<<<<<<<<<<<<<
15955  *
15956  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df,
15957  */
15958  __pyx_t_25 = __pyx_v_eN;
15959  __pyx_t_26 = __pyx_v_ebN;
15960  __pyx_t_9 = -1;
15961  if (__pyx_t_25 < 0) {
15962  __pyx_t_25 += __pyx_pybuffernd_flux.diminfo[0].shape;
15963  if (unlikely(__pyx_t_25 < 0)) __pyx_t_9 = 0;
15964  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_flux.diminfo[0].shape)) __pyx_t_9 = 0;
15965  if (__pyx_t_26 < 0) {
15966  __pyx_t_26 += __pyx_pybuffernd_flux.diminfo[1].shape;
15967  if (unlikely(__pyx_t_26 < 0)) __pyx_t_9 = 1;
15968  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_flux.diminfo[1].shape)) __pyx_t_9 = 1;
15969  if (unlikely(__pyx_t_9 != -1)) {
15970  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15971  __PYX_ERR(0, 730, __pyx_L1_error)
15972  }
15973  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_flux.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_flux.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_flux.diminfo[1].strides) = __pyx_v_integral;
15974  }
15975  }
15976 
15977  /* "subsurfaceTransportFunctions.pyx":717
15978  * #ELLAM
15979  * ########################################################################
15980  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
15981  * numpy.ndarray[DTYPE_t,ndim=4] n,
15982  * numpy.ndarray[DTYPE_t,ndim=3] dS,
15983  */
15984 
15985  /* function exit code */
15986  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15987  goto __pyx_L0;
15988  __pyx_L1_error:;
15989  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
15990  __Pyx_PyThreadState_declare
15991  __Pyx_PyThreadState_assign
15992  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
15993  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
15994  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_flux.rcbuffer->pybuffer);
15995  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
15996  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
15997  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
15998  __Pyx_AddTraceback("subsurfaceTransportFunctions.calculateNormalFlux", __pyx_clineno, __pyx_lineno, __pyx_filename);
15999  __pyx_r = NULL;
16000  goto __pyx_L2;
16001  __pyx_L0:;
16002  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
16003  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_flux.rcbuffer->pybuffer);
16004  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
16005  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
16006  __pyx_L2:;
16007  __Pyx_XGIVEREF(__pyx_r);
16008  __Pyx_RefNannyFinishContext();
16009  return __pyx_r;
16010 }
16011 
16012 /* "subsurfaceTransportFunctions.pyx":732
16013  * flux[eN,ebN] = integral
16014  *
16015  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
16016  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
16017  * numpy.ndarray[DTYPE_t,ndim=2] dm,
16018  */
16019 
16020 /* Python wrapper */
16021 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
16022 static char __pyx_doc_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity[] = "\n simple approximation for \\lambda = df/\010ar{dm} using \010ar{dm} = \014rac{1}{\\Omega_e} \\int_{\\Omega_e} dm dV\n ";
16023 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity = {"computeSimpleCharacteristicVelocityFromElementVelocity", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity};
16024 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
16025  PyArrayObject *__pyx_v_df = 0;
16026  PyArrayObject *__pyx_v_characteristic_velocity = 0;
16027  PyArrayObject *__pyx_v_dm = 0;
16028  PyArrayObject *__pyx_v_dV = 0;
16029  PyObject *__pyx_r = 0;
16030  __Pyx_RefNannyDeclarations
16031  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromElementVelocity (wrapper)", 0);
16032  {
16033  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_df,&__pyx_n_s_characteristic_velocity,&__pyx_n_s_dm,&__pyx_n_s_dV,0};
16034  PyObject* values[4] = {0,0,0,0};
16035  if (unlikely(__pyx_kwds)) {
16036  Py_ssize_t kw_args;
16037  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
16038  switch (pos_args) {
16039  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16040  CYTHON_FALLTHROUGH;
16041  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16042  CYTHON_FALLTHROUGH;
16043  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16044  CYTHON_FALLTHROUGH;
16045  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16046  CYTHON_FALLTHROUGH;
16047  case 0: break;
16048  default: goto __pyx_L5_argtuple_error;
16049  }
16050  kw_args = PyDict_Size(__pyx_kwds);
16051  switch (pos_args) {
16052  case 0:
16053  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_df)) != 0)) kw_args--;
16054  else goto __pyx_L5_argtuple_error;
16055  CYTHON_FALLTHROUGH;
16056  case 1:
16057  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_characteristic_velocity)) != 0)) kw_args--;
16058  else {
16059  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, 1); __PYX_ERR(0, 732, __pyx_L3_error)
16060  }
16061  CYTHON_FALLTHROUGH;
16062  case 2:
16063  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dm)) != 0)) kw_args--;
16064  else {
16065  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, 2); __PYX_ERR(0, 732, __pyx_L3_error)
16066  }
16067  CYTHON_FALLTHROUGH;
16068  case 3:
16069  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
16070  else {
16071  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, 3); __PYX_ERR(0, 732, __pyx_L3_error)
16072  }
16073  }
16074  if (unlikely(kw_args > 0)) {
16075  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeSimpleCharacteristicVelocityFromElementVelocity") < 0)) __PYX_ERR(0, 732, __pyx_L3_error)
16076  }
16077  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
16078  goto __pyx_L5_argtuple_error;
16079  } else {
16080  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16081  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16082  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16083  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16084  }
16085  __pyx_v_df = ((PyArrayObject *)values[0]);
16086  __pyx_v_characteristic_velocity = ((PyArrayObject *)values[1]);
16087  __pyx_v_dm = ((PyArrayObject *)values[2]);
16088  __pyx_v_dV = ((PyArrayObject *)values[3]);
16089  }
16090  goto __pyx_L4_argument_unpacking_done;
16091  __pyx_L5_argtuple_error:;
16092  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 732, __pyx_L3_error)
16093  __pyx_L3_error:;
16094  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromElementVelocity", __pyx_clineno, __pyx_lineno, __pyx_filename);
16095  __Pyx_RefNannyFinishContext();
16096  return NULL;
16097  __pyx_L4_argument_unpacking_done:;
16098  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_df), __pyx_ptype_5numpy_ndarray, 1, "df", 0))) __PYX_ERR(0, 732, __pyx_L1_error)
16099  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_characteristic_velocity), __pyx_ptype_5numpy_ndarray, 1, "characteristic_velocity", 0))) __PYX_ERR(0, 733, __pyx_L1_error)
16100  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dm), __pyx_ptype_5numpy_ndarray, 1, "dm", 0))) __PYX_ERR(0, 734, __pyx_L1_error)
16101  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) __PYX_ERR(0, 735, __pyx_L1_error)
16102  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity(__pyx_self, __pyx_v_df, __pyx_v_characteristic_velocity, __pyx_v_dm, __pyx_v_dV);
16103 
16104  /* function exit code */
16105  goto __pyx_L0;
16106  __pyx_L1_error:;
16107  __pyx_r = NULL;
16108  __pyx_L0:;
16109  __Pyx_RefNannyFinishContext();
16110  return __pyx_r;
16111 }
16112 
16113 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df, PyArrayObject *__pyx_v_characteristic_velocity, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV) {
16114  int __pyx_v_eN;
16115  int __pyx_v_k;
16116  int __pyx_v_I;
16117  double __pyx_v_omega_e;
16118  double __pyx_v_vol_e;
16119  __Pyx_LocalBuf_ND __pyx_pybuffernd_characteristic_velocity;
16120  __Pyx_Buffer __pyx_pybuffer_characteristic_velocity;
16121  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
16122  __Pyx_Buffer __pyx_pybuffer_dV;
16123  __Pyx_LocalBuf_ND __pyx_pybuffernd_df;
16124  __Pyx_Buffer __pyx_pybuffer_df;
16125  __Pyx_LocalBuf_ND __pyx_pybuffernd_dm;
16126  __Pyx_Buffer __pyx_pybuffer_dm;
16127  PyObject *__pyx_r = NULL;
16128  __Pyx_RefNannyDeclarations
16129  npy_intp __pyx_t_1;
16130  npy_intp __pyx_t_2;
16131  int __pyx_t_3;
16132  npy_intp __pyx_t_4;
16133  npy_intp __pyx_t_5;
16134  int __pyx_t_6;
16135  Py_ssize_t __pyx_t_7;
16136  Py_ssize_t __pyx_t_8;
16137  int __pyx_t_9;
16138  Py_ssize_t __pyx_t_10;
16139  Py_ssize_t __pyx_t_11;
16140  Py_ssize_t __pyx_t_12;
16141  Py_ssize_t __pyx_t_13;
16142  npy_intp __pyx_t_14;
16143  npy_intp __pyx_t_15;
16144  Py_ssize_t __pyx_t_16;
16145  Py_ssize_t __pyx_t_17;
16146  Py_ssize_t __pyx_t_18;
16147  int __pyx_t_19;
16148  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_20;
16149  double __pyx_t_21;
16150  Py_ssize_t __pyx_t_22;
16151  Py_ssize_t __pyx_t_23;
16152  Py_ssize_t __pyx_t_24;
16153  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromElementVelocity", 0);
16154  __pyx_pybuffer_df.pybuffer.buf = NULL;
16155  __pyx_pybuffer_df.refcount = 0;
16156  __pyx_pybuffernd_df.data = NULL;
16157  __pyx_pybuffernd_df.rcbuffer = &__pyx_pybuffer_df;
16158  __pyx_pybuffer_characteristic_velocity.pybuffer.buf = NULL;
16159  __pyx_pybuffer_characteristic_velocity.refcount = 0;
16160  __pyx_pybuffernd_characteristic_velocity.data = NULL;
16161  __pyx_pybuffernd_characteristic_velocity.rcbuffer = &__pyx_pybuffer_characteristic_velocity;
16162  __pyx_pybuffer_dm.pybuffer.buf = NULL;
16163  __pyx_pybuffer_dm.refcount = 0;
16164  __pyx_pybuffernd_dm.data = NULL;
16165  __pyx_pybuffernd_dm.rcbuffer = &__pyx_pybuffer_dm;
16166  __pyx_pybuffer_dV.pybuffer.buf = NULL;
16167  __pyx_pybuffer_dV.refcount = 0;
16168  __pyx_pybuffernd_dV.data = NULL;
16169  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
16170  {
16171  __Pyx_BufFmt_StackElem __pyx_stack[1];
16172  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_df.rcbuffer->pybuffer, (PyObject*)__pyx_v_df, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 732, __pyx_L1_error)
16173  }
16174  __pyx_pybuffernd_df.diminfo[0].strides = __pyx_pybuffernd_df.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_df.diminfo[0].shape = __pyx_pybuffernd_df.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_df.diminfo[1].strides = __pyx_pybuffernd_df.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_df.diminfo[1].shape = __pyx_pybuffernd_df.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_df.diminfo[2].strides = __pyx_pybuffernd_df.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_df.diminfo[2].shape = __pyx_pybuffernd_df.rcbuffer->pybuffer.shape[2];
16175  {
16176  __Pyx_BufFmt_StackElem __pyx_stack[1];
16177  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer, (PyObject*)__pyx_v_characteristic_velocity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 732, __pyx_L1_error)
16178  }
16179  __pyx_pybuffernd_characteristic_velocity.diminfo[0].strides = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_characteristic_velocity.diminfo[0].shape = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_characteristic_velocity.diminfo[1].strides = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_characteristic_velocity.diminfo[1].shape = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_characteristic_velocity.diminfo[2].strides = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_characteristic_velocity.diminfo[2].shape = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.shape[2];
16180  {
16181  __Pyx_BufFmt_StackElem __pyx_stack[1];
16182  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dm.rcbuffer->pybuffer, (PyObject*)__pyx_v_dm, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 732, __pyx_L1_error)
16183  }
16184  __pyx_pybuffernd_dm.diminfo[0].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dm.diminfo[0].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dm.diminfo[1].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dm.diminfo[1].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[1];
16185  {
16186  __Pyx_BufFmt_StackElem __pyx_stack[1];
16187  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 732, __pyx_L1_error)
16188  }
16189  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
16190 
16191  /* "subsurfaceTransportFunctions.pyx":743
16192  * cdef double omega_e, vol_e
16193  *
16194  * for eN in range(dm.shape[0]): # <<<<<<<<<<<<<<
16195  * omega_e = 0.0
16196  * vol_e = 0.0
16197  */
16198  __pyx_t_1 = (__pyx_v_dm->dimensions[0]);
16199  __pyx_t_2 = __pyx_t_1;
16200  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
16201  __pyx_v_eN = __pyx_t_3;
16202 
16203  /* "subsurfaceTransportFunctions.pyx":744
16204  *
16205  * for eN in range(dm.shape[0]):
16206  * omega_e = 0.0 # <<<<<<<<<<<<<<
16207  * vol_e = 0.0
16208  * for k in range(dm.shape[1]):
16209  */
16210  __pyx_v_omega_e = 0.0;
16211 
16212  /* "subsurfaceTransportFunctions.pyx":745
16213  * for eN in range(dm.shape[0]):
16214  * omega_e = 0.0
16215  * vol_e = 0.0 # <<<<<<<<<<<<<<
16216  * for k in range(dm.shape[1]):
16217  * vol_e += dV[eN,k]
16218  */
16219  __pyx_v_vol_e = 0.0;
16220 
16221  /* "subsurfaceTransportFunctions.pyx":746
16222  * omega_e = 0.0
16223  * vol_e = 0.0
16224  * for k in range(dm.shape[1]): # <<<<<<<<<<<<<<
16225  * vol_e += dV[eN,k]
16226  * omega_e += dV[eN,k]*dm[eN,k]
16227  */
16228  __pyx_t_4 = (__pyx_v_dm->dimensions[1]);
16229  __pyx_t_5 = __pyx_t_4;
16230  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16231  __pyx_v_k = __pyx_t_6;
16232 
16233  /* "subsurfaceTransportFunctions.pyx":747
16234  * vol_e = 0.0
16235  * for k in range(dm.shape[1]):
16236  * vol_e += dV[eN,k] # <<<<<<<<<<<<<<
16237  * omega_e += dV[eN,k]*dm[eN,k]
16238  * for k in range(df.shape[1]):
16239  */
16240  __pyx_t_7 = __pyx_v_eN;
16241  __pyx_t_8 = __pyx_v_k;
16242  __pyx_t_9 = -1;
16243  if (__pyx_t_7 < 0) {
16244  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[0].shape;
16245  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
16246  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
16247  if (__pyx_t_8 < 0) {
16248  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[1].shape;
16249  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
16250  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
16251  if (unlikely(__pyx_t_9 != -1)) {
16252  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16253  __PYX_ERR(0, 747, __pyx_L1_error)
16254  }
16255  __pyx_v_vol_e = (__pyx_v_vol_e + (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[1].strides)));
16256 
16257  /* "subsurfaceTransportFunctions.pyx":748
16258  * for k in range(dm.shape[1]):
16259  * vol_e += dV[eN,k]
16260  * omega_e += dV[eN,k]*dm[eN,k] # <<<<<<<<<<<<<<
16261  * for k in range(df.shape[1]):
16262  * for I in range(df.shape[2]):
16263  */
16264  __pyx_t_10 = __pyx_v_eN;
16265  __pyx_t_11 = __pyx_v_k;
16266  __pyx_t_9 = -1;
16267  if (__pyx_t_10 < 0) {
16268  __pyx_t_10 += __pyx_pybuffernd_dV.diminfo[0].shape;
16269  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
16270  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
16271  if (__pyx_t_11 < 0) {
16272  __pyx_t_11 += __pyx_pybuffernd_dV.diminfo[1].shape;
16273  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
16274  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
16275  if (unlikely(__pyx_t_9 != -1)) {
16276  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16277  __PYX_ERR(0, 748, __pyx_L1_error)
16278  }
16279  __pyx_t_12 = __pyx_v_eN;
16280  __pyx_t_13 = __pyx_v_k;
16281  __pyx_t_9 = -1;
16282  if (__pyx_t_12 < 0) {
16283  __pyx_t_12 += __pyx_pybuffernd_dm.diminfo[0].shape;
16284  if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 0;
16285  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_dm.diminfo[0].shape)) __pyx_t_9 = 0;
16286  if (__pyx_t_13 < 0) {
16287  __pyx_t_13 += __pyx_pybuffernd_dm.diminfo[1].shape;
16288  if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 1;
16289  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_dm.diminfo[1].shape)) __pyx_t_9 = 1;
16290  if (unlikely(__pyx_t_9 != -1)) {
16291  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16292  __PYX_ERR(0, 748, __pyx_L1_error)
16293  }
16294  __pyx_v_omega_e = (__pyx_v_omega_e + ((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dm.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_dm.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_dm.diminfo[1].strides))));
16295  }
16296 
16297  /* "subsurfaceTransportFunctions.pyx":749
16298  * vol_e += dV[eN,k]
16299  * omega_e += dV[eN,k]*dm[eN,k]
16300  * for k in range(df.shape[1]): # <<<<<<<<<<<<<<
16301  * for I in range(df.shape[2]):
16302  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
16303  */
16304  __pyx_t_4 = (__pyx_v_df->dimensions[1]);
16305  __pyx_t_5 = __pyx_t_4;
16306  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16307  __pyx_v_k = __pyx_t_6;
16308 
16309  /* "subsurfaceTransportFunctions.pyx":750
16310  * omega_e += dV[eN,k]*dm[eN,k]
16311  * for k in range(df.shape[1]):
16312  * for I in range(df.shape[2]): # <<<<<<<<<<<<<<
16313  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
16314  *
16315  */
16316  __pyx_t_14 = (__pyx_v_df->dimensions[2]);
16317  __pyx_t_15 = __pyx_t_14;
16318  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_15; __pyx_t_9+=1) {
16319  __pyx_v_I = __pyx_t_9;
16320 
16321  /* "subsurfaceTransportFunctions.pyx":751
16322  * for k in range(df.shape[1]):
16323  * for I in range(df.shape[2]):
16324  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12) # <<<<<<<<<<<<<<
16325  *
16326  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs,
16327  */
16328  __pyx_t_16 = __pyx_v_eN;
16329  __pyx_t_17 = __pyx_v_k;
16330  __pyx_t_18 = __pyx_v_I;
16331  __pyx_t_19 = -1;
16332  if (__pyx_t_16 < 0) {
16333  __pyx_t_16 += __pyx_pybuffernd_df.diminfo[0].shape;
16334  if (unlikely(__pyx_t_16 < 0)) __pyx_t_19 = 0;
16335  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_df.diminfo[0].shape)) __pyx_t_19 = 0;
16336  if (__pyx_t_17 < 0) {
16337  __pyx_t_17 += __pyx_pybuffernd_df.diminfo[1].shape;
16338  if (unlikely(__pyx_t_17 < 0)) __pyx_t_19 = 1;
16339  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_df.diminfo[1].shape)) __pyx_t_19 = 1;
16340  if (__pyx_t_18 < 0) {
16341  __pyx_t_18 += __pyx_pybuffernd_df.diminfo[2].shape;
16342  if (unlikely(__pyx_t_18 < 0)) __pyx_t_19 = 2;
16343  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_df.diminfo[2].shape)) __pyx_t_19 = 2;
16344  if (unlikely(__pyx_t_19 != -1)) {
16345  __Pyx_RaiseBufferIndexError(__pyx_t_19);
16346  __PYX_ERR(0, 751, __pyx_L1_error)
16347  }
16348  __pyx_t_20 = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_df.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_df.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_df.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_df.diminfo[2].strides)) * __pyx_v_vol_e);
16349  __pyx_t_21 = (__pyx_v_omega_e + 1.0e-12);
16350  if (unlikely(__pyx_t_21 == 0)) {
16351  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
16352  __PYX_ERR(0, 751, __pyx_L1_error)
16353  }
16354  __pyx_t_22 = __pyx_v_eN;
16355  __pyx_t_23 = __pyx_v_k;
16356  __pyx_t_24 = __pyx_v_I;
16357  __pyx_t_19 = -1;
16358  if (__pyx_t_22 < 0) {
16359  __pyx_t_22 += __pyx_pybuffernd_characteristic_velocity.diminfo[0].shape;
16360  if (unlikely(__pyx_t_22 < 0)) __pyx_t_19 = 0;
16361  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_characteristic_velocity.diminfo[0].shape)) __pyx_t_19 = 0;
16362  if (__pyx_t_23 < 0) {
16363  __pyx_t_23 += __pyx_pybuffernd_characteristic_velocity.diminfo[1].shape;
16364  if (unlikely(__pyx_t_23 < 0)) __pyx_t_19 = 1;
16365  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_characteristic_velocity.diminfo[1].shape)) __pyx_t_19 = 1;
16366  if (__pyx_t_24 < 0) {
16367  __pyx_t_24 += __pyx_pybuffernd_characteristic_velocity.diminfo[2].shape;
16368  if (unlikely(__pyx_t_24 < 0)) __pyx_t_19 = 2;
16369  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_characteristic_velocity.diminfo[2].shape)) __pyx_t_19 = 2;
16370  if (unlikely(__pyx_t_19 != -1)) {
16371  __Pyx_RaiseBufferIndexError(__pyx_t_19);
16372  __PYX_ERR(0, 751, __pyx_L1_error)
16373  }
16374  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_characteristic_velocity.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_characteristic_velocity.diminfo[1].strides, __pyx_t_24, __pyx_pybuffernd_characteristic_velocity.diminfo[2].strides) = (__pyx_t_20 / __pyx_t_21);
16375  }
16376  }
16377  }
16378 
16379  /* "subsurfaceTransportFunctions.pyx":732
16380  * flux[eN,ebN] = integral
16381  *
16382  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
16383  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
16384  * numpy.ndarray[DTYPE_t,ndim=2] dm,
16385  */
16386 
16387  /* function exit code */
16388  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16389  goto __pyx_L0;
16390  __pyx_L1_error:;
16391  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
16392  __Pyx_PyThreadState_declare
16393  __Pyx_PyThreadState_assign
16394  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
16395  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer);
16396  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
16397  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df.rcbuffer->pybuffer);
16398  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
16399  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
16400  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromElementVelocity", __pyx_clineno, __pyx_lineno, __pyx_filename);
16401  __pyx_r = NULL;
16402  goto __pyx_L2;
16403  __pyx_L0:;
16404  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer);
16405  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
16406  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df.rcbuffer->pybuffer);
16407  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
16408  __pyx_L2:;
16409  __Pyx_XGIVEREF(__pyx_r);
16410  __Pyx_RefNannyFinishContext();
16411  return __pyx_r;
16412 }
16413 
16414 /* "subsurfaceTransportFunctions.pyx":753
16415  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
16416  *
16417  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
16418  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
16419  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
16420  */
16421 
16422 /* Python wrapper */
16423 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
16424 static char __pyx_doc_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs[] = "\n simple approximation for \\lambda = df/\010ar{dm} using \010ar{dm} = \014rac{1}{\\Omega_e} \\int_{\\Omega_e} dm dV\n ";
16425 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs = {"computeSimpleCharacteristicVelocityFromVelocityDOFs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs};
16426 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
16427  PyArrayObject *__pyx_v_df_dofs = 0;
16428  PyArrayObject *__pyx_v_characteristic_velocity_dofs = 0;
16429  PyArrayObject *__pyx_v_l2g = 0;
16430  PyArrayObject *__pyx_v_dm = 0;
16431  PyArrayObject *__pyx_v_dV = 0;
16432  PyObject *__pyx_r = 0;
16433  __Pyx_RefNannyDeclarations
16434  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromVelocityDOFs (wrapper)", 0);
16435  {
16436  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_df_dofs,&__pyx_n_s_characteristic_velocity_dofs,&__pyx_n_s_l2g,&__pyx_n_s_dm,&__pyx_n_s_dV,0};
16437  PyObject* values[5] = {0,0,0,0,0};
16438  if (unlikely(__pyx_kwds)) {
16439  Py_ssize_t kw_args;
16440  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
16441  switch (pos_args) {
16442  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16443  CYTHON_FALLTHROUGH;
16444  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16445  CYTHON_FALLTHROUGH;
16446  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16447  CYTHON_FALLTHROUGH;
16448  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16449  CYTHON_FALLTHROUGH;
16450  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16451  CYTHON_FALLTHROUGH;
16452  case 0: break;
16453  default: goto __pyx_L5_argtuple_error;
16454  }
16455  kw_args = PyDict_Size(__pyx_kwds);
16456  switch (pos_args) {
16457  case 0:
16458  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_df_dofs)) != 0)) kw_args--;
16459  else goto __pyx_L5_argtuple_error;
16460  CYTHON_FALLTHROUGH;
16461  case 1:
16462  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_characteristic_velocity_dofs)) != 0)) kw_args--;
16463  else {
16464  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 1); __PYX_ERR(0, 753, __pyx_L3_error)
16465  }
16466  CYTHON_FALLTHROUGH;
16467  case 2:
16468  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_l2g)) != 0)) kw_args--;
16469  else {
16470  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 2); __PYX_ERR(0, 753, __pyx_L3_error)
16471  }
16472  CYTHON_FALLTHROUGH;
16473  case 3:
16474  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dm)) != 0)) kw_args--;
16475  else {
16476  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 3); __PYX_ERR(0, 753, __pyx_L3_error)
16477  }
16478  CYTHON_FALLTHROUGH;
16479  case 4:
16480  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
16481  else {
16482  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 4); __PYX_ERR(0, 753, __pyx_L3_error)
16483  }
16484  }
16485  if (unlikely(kw_args > 0)) {
16486  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeSimpleCharacteristicVelocityFromVelocityDOFs") < 0)) __PYX_ERR(0, 753, __pyx_L3_error)
16487  }
16488  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
16489  goto __pyx_L5_argtuple_error;
16490  } else {
16491  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16492  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16493  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16494  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16495  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16496  }
16497  __pyx_v_df_dofs = ((PyArrayObject *)values[0]);
16498  __pyx_v_characteristic_velocity_dofs = ((PyArrayObject *)values[1]);
16499  __pyx_v_l2g = ((PyArrayObject *)values[2]);
16500  __pyx_v_dm = ((PyArrayObject *)values[3]);
16501  __pyx_v_dV = ((PyArrayObject *)values[4]);
16502  }
16503  goto __pyx_L4_argument_unpacking_done;
16504  __pyx_L5_argtuple_error:;
16505  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 753, __pyx_L3_error)
16506  __pyx_L3_error:;
16507  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromVelocityDOFs", __pyx_clineno, __pyx_lineno, __pyx_filename);
16508  __Pyx_RefNannyFinishContext();
16509  return NULL;
16510  __pyx_L4_argument_unpacking_done:;
16511  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_df_dofs), __pyx_ptype_5numpy_ndarray, 1, "df_dofs", 0))) __PYX_ERR(0, 753, __pyx_L1_error)
16512  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_characteristic_velocity_dofs), __pyx_ptype_5numpy_ndarray, 1, "characteristic_velocity_dofs", 0))) __PYX_ERR(0, 754, __pyx_L1_error)
16513  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_l2g), __pyx_ptype_5numpy_ndarray, 1, "l2g", 0))) __PYX_ERR(0, 755, __pyx_L1_error)
16514  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dm), __pyx_ptype_5numpy_ndarray, 1, "dm", 0))) __PYX_ERR(0, 756, __pyx_L1_error)
16515  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) __PYX_ERR(0, 757, __pyx_L1_error)
16516  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs(__pyx_self, __pyx_v_df_dofs, __pyx_v_characteristic_velocity_dofs, __pyx_v_l2g, __pyx_v_dm, __pyx_v_dV);
16517 
16518  /* function exit code */
16519  goto __pyx_L0;
16520  __pyx_L1_error:;
16521  __pyx_r = NULL;
16522  __pyx_L0:;
16523  __Pyx_RefNannyFinishContext();
16524  return __pyx_r;
16525 }
16526 
16527 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df_dofs, PyArrayObject *__pyx_v_characteristic_velocity_dofs, PyArrayObject *__pyx_v_l2g, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV) {
16528  int __pyx_v_eN;
16529  int __pyx_v_k;
16530  int __pyx_v_j;
16531  int __pyx_v_J;
16532  double __pyx_v_omega_e;
16533  double __pyx_v_vol_e;
16534  __Pyx_LocalBuf_ND __pyx_pybuffernd_characteristic_velocity_dofs;
16535  __Pyx_Buffer __pyx_pybuffer_characteristic_velocity_dofs;
16536  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
16537  __Pyx_Buffer __pyx_pybuffer_dV;
16538  __Pyx_LocalBuf_ND __pyx_pybuffernd_df_dofs;
16539  __Pyx_Buffer __pyx_pybuffer_df_dofs;
16540  __Pyx_LocalBuf_ND __pyx_pybuffernd_dm;
16541  __Pyx_Buffer __pyx_pybuffer_dm;
16542  __Pyx_LocalBuf_ND __pyx_pybuffernd_l2g;
16543  __Pyx_Buffer __pyx_pybuffer_l2g;
16544  PyObject *__pyx_r = NULL;
16545  __Pyx_RefNannyDeclarations
16546  npy_intp __pyx_t_1;
16547  npy_intp __pyx_t_2;
16548  int __pyx_t_3;
16549  npy_intp __pyx_t_4;
16550  npy_intp __pyx_t_5;
16551  int __pyx_t_6;
16552  Py_ssize_t __pyx_t_7;
16553  Py_ssize_t __pyx_t_8;
16554  int __pyx_t_9;
16555  Py_ssize_t __pyx_t_10;
16556  Py_ssize_t __pyx_t_11;
16557  Py_ssize_t __pyx_t_12;
16558  Py_ssize_t __pyx_t_13;
16559  Py_ssize_t __pyx_t_14;
16560  Py_ssize_t __pyx_t_15;
16561  Py_ssize_t __pyx_t_16;
16562  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_17;
16563  double __pyx_t_18;
16564  Py_ssize_t __pyx_t_19;
16565  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromVelocityDOFs", 0);
16566  __pyx_pybuffer_df_dofs.pybuffer.buf = NULL;
16567  __pyx_pybuffer_df_dofs.refcount = 0;
16568  __pyx_pybuffernd_df_dofs.data = NULL;
16569  __pyx_pybuffernd_df_dofs.rcbuffer = &__pyx_pybuffer_df_dofs;
16570  __pyx_pybuffer_characteristic_velocity_dofs.pybuffer.buf = NULL;
16571  __pyx_pybuffer_characteristic_velocity_dofs.refcount = 0;
16572  __pyx_pybuffernd_characteristic_velocity_dofs.data = NULL;
16573  __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer = &__pyx_pybuffer_characteristic_velocity_dofs;
16574  __pyx_pybuffer_l2g.pybuffer.buf = NULL;
16575  __pyx_pybuffer_l2g.refcount = 0;
16576  __pyx_pybuffernd_l2g.data = NULL;
16577  __pyx_pybuffernd_l2g.rcbuffer = &__pyx_pybuffer_l2g;
16578  __pyx_pybuffer_dm.pybuffer.buf = NULL;
16579  __pyx_pybuffer_dm.refcount = 0;
16580  __pyx_pybuffernd_dm.data = NULL;
16581  __pyx_pybuffernd_dm.rcbuffer = &__pyx_pybuffer_dm;
16582  __pyx_pybuffer_dV.pybuffer.buf = NULL;
16583  __pyx_pybuffer_dV.refcount = 0;
16584  __pyx_pybuffernd_dV.data = NULL;
16585  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
16586  {
16587  __Pyx_BufFmt_StackElem __pyx_stack[1];
16588  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_df_dofs.rcbuffer->pybuffer, (PyObject*)__pyx_v_df_dofs, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
16589  }
16590  __pyx_pybuffernd_df_dofs.diminfo[0].strides = __pyx_pybuffernd_df_dofs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_df_dofs.diminfo[0].shape = __pyx_pybuffernd_df_dofs.rcbuffer->pybuffer.shape[0];
16591  {
16592  __Pyx_BufFmt_StackElem __pyx_stack[1];
16593  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer, (PyObject*)__pyx_v_characteristic_velocity_dofs, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
16594  }
16595  __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].strides = __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].shape = __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer.shape[0];
16596  {
16597  __Pyx_BufFmt_StackElem __pyx_stack[1];
16598  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_l2g.rcbuffer->pybuffer, (PyObject*)__pyx_v_l2g, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
16599  }
16600  __pyx_pybuffernd_l2g.diminfo[0].strides = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_l2g.diminfo[0].shape = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_l2g.diminfo[1].strides = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_l2g.diminfo[1].shape = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.shape[1];
16601  {
16602  __Pyx_BufFmt_StackElem __pyx_stack[1];
16603  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dm.rcbuffer->pybuffer, (PyObject*)__pyx_v_dm, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
16604  }
16605  __pyx_pybuffernd_dm.diminfo[0].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dm.diminfo[0].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dm.diminfo[1].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dm.diminfo[1].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[1];
16606  {
16607  __Pyx_BufFmt_StackElem __pyx_stack[1];
16608  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
16609  }
16610  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
16611 
16612  /* "subsurfaceTransportFunctions.pyx":765
16613  * cdef double omega_e, vol_e
16614  *
16615  * for eN in range(dm.shape[0]): # <<<<<<<<<<<<<<
16616  * omega_e = 0.0
16617  * vol_e = 0.0
16618  */
16619  __pyx_t_1 = (__pyx_v_dm->dimensions[0]);
16620  __pyx_t_2 = __pyx_t_1;
16621  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
16622  __pyx_v_eN = __pyx_t_3;
16623 
16624  /* "subsurfaceTransportFunctions.pyx":766
16625  *
16626  * for eN in range(dm.shape[0]):
16627  * omega_e = 0.0 # <<<<<<<<<<<<<<
16628  * vol_e = 0.0
16629  * for k in range(dm.shape[1]):
16630  */
16631  __pyx_v_omega_e = 0.0;
16632 
16633  /* "subsurfaceTransportFunctions.pyx":767
16634  * for eN in range(dm.shape[0]):
16635  * omega_e = 0.0
16636  * vol_e = 0.0 # <<<<<<<<<<<<<<
16637  * for k in range(dm.shape[1]):
16638  * vol_e += dV[eN,k]
16639  */
16640  __pyx_v_vol_e = 0.0;
16641 
16642  /* "subsurfaceTransportFunctions.pyx":768
16643  * omega_e = 0.0
16644  * vol_e = 0.0
16645  * for k in range(dm.shape[1]): # <<<<<<<<<<<<<<
16646  * vol_e += dV[eN,k]
16647  * omega_e += dV[eN,k]*dm[eN,k]
16648  */
16649  __pyx_t_4 = (__pyx_v_dm->dimensions[1]);
16650  __pyx_t_5 = __pyx_t_4;
16651  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16652  __pyx_v_k = __pyx_t_6;
16653 
16654  /* "subsurfaceTransportFunctions.pyx":769
16655  * vol_e = 0.0
16656  * for k in range(dm.shape[1]):
16657  * vol_e += dV[eN,k] # <<<<<<<<<<<<<<
16658  * omega_e += dV[eN,k]*dm[eN,k]
16659  * for j in range(l2g.shape[1]):
16660  */
16661  __pyx_t_7 = __pyx_v_eN;
16662  __pyx_t_8 = __pyx_v_k;
16663  __pyx_t_9 = -1;
16664  if (__pyx_t_7 < 0) {
16665  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[0].shape;
16666  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
16667  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
16668  if (__pyx_t_8 < 0) {
16669  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[1].shape;
16670  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
16671  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
16672  if (unlikely(__pyx_t_9 != -1)) {
16673  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16674  __PYX_ERR(0, 769, __pyx_L1_error)
16675  }
16676  __pyx_v_vol_e = (__pyx_v_vol_e + (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[1].strides)));
16677 
16678  /* "subsurfaceTransportFunctions.pyx":770
16679  * for k in range(dm.shape[1]):
16680  * vol_e += dV[eN,k]
16681  * omega_e += dV[eN,k]*dm[eN,k] # <<<<<<<<<<<<<<
16682  * for j in range(l2g.shape[1]):
16683  * J = l2g[eN,j]
16684  */
16685  __pyx_t_10 = __pyx_v_eN;
16686  __pyx_t_11 = __pyx_v_k;
16687  __pyx_t_9 = -1;
16688  if (__pyx_t_10 < 0) {
16689  __pyx_t_10 += __pyx_pybuffernd_dV.diminfo[0].shape;
16690  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
16691  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
16692  if (__pyx_t_11 < 0) {
16693  __pyx_t_11 += __pyx_pybuffernd_dV.diminfo[1].shape;
16694  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
16695  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
16696  if (unlikely(__pyx_t_9 != -1)) {
16697  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16698  __PYX_ERR(0, 770, __pyx_L1_error)
16699  }
16700  __pyx_t_12 = __pyx_v_eN;
16701  __pyx_t_13 = __pyx_v_k;
16702  __pyx_t_9 = -1;
16703  if (__pyx_t_12 < 0) {
16704  __pyx_t_12 += __pyx_pybuffernd_dm.diminfo[0].shape;
16705  if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 0;
16706  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_dm.diminfo[0].shape)) __pyx_t_9 = 0;
16707  if (__pyx_t_13 < 0) {
16708  __pyx_t_13 += __pyx_pybuffernd_dm.diminfo[1].shape;
16709  if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 1;
16710  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_dm.diminfo[1].shape)) __pyx_t_9 = 1;
16711  if (unlikely(__pyx_t_9 != -1)) {
16712  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16713  __PYX_ERR(0, 770, __pyx_L1_error)
16714  }
16715  __pyx_v_omega_e = (__pyx_v_omega_e + ((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dm.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_dm.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_dm.diminfo[1].strides))));
16716  }
16717 
16718  /* "subsurfaceTransportFunctions.pyx":771
16719  * vol_e += dV[eN,k]
16720  * omega_e += dV[eN,k]*dm[eN,k]
16721  * for j in range(l2g.shape[1]): # <<<<<<<<<<<<<<
16722  * J = l2g[eN,j]
16723  * characteristic_velocity_dofs[J] = df_dofs[J]*vol_e/(omega_e+1.0e-12)
16724  */
16725  __pyx_t_4 = (__pyx_v_l2g->dimensions[1]);
16726  __pyx_t_5 = __pyx_t_4;
16727  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16728  __pyx_v_j = __pyx_t_6;
16729 
16730  /* "subsurfaceTransportFunctions.pyx":772
16731  * omega_e += dV[eN,k]*dm[eN,k]
16732  * for j in range(l2g.shape[1]):
16733  * J = l2g[eN,j] # <<<<<<<<<<<<<<
16734  * characteristic_velocity_dofs[J] = df_dofs[J]*vol_e/(omega_e+1.0e-12)
16735  *
16736  */
16737  __pyx_t_14 = __pyx_v_eN;
16738  __pyx_t_15 = __pyx_v_j;
16739  __pyx_t_9 = -1;
16740  if (__pyx_t_14 < 0) {
16741  __pyx_t_14 += __pyx_pybuffernd_l2g.diminfo[0].shape;
16742  if (unlikely(__pyx_t_14 < 0)) __pyx_t_9 = 0;
16743  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_l2g.diminfo[0].shape)) __pyx_t_9 = 0;
16744  if (__pyx_t_15 < 0) {
16745  __pyx_t_15 += __pyx_pybuffernd_l2g.diminfo[1].shape;
16746  if (unlikely(__pyx_t_15 < 0)) __pyx_t_9 = 1;
16747  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_l2g.diminfo[1].shape)) __pyx_t_9 = 1;
16748  if (unlikely(__pyx_t_9 != -1)) {
16749  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16750  __PYX_ERR(0, 772, __pyx_L1_error)
16751  }
16752  __pyx_v_J = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_l2g.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_l2g.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_l2g.diminfo[1].strides));
16753 
16754  /* "subsurfaceTransportFunctions.pyx":773
16755  * for j in range(l2g.shape[1]):
16756  * J = l2g[eN,j]
16757  * characteristic_velocity_dofs[J] = df_dofs[J]*vol_e/(omega_e+1.0e-12) # <<<<<<<<<<<<<<
16758  *
16759  * #problem specific velocity evaluation
16760  */
16761  __pyx_t_16 = __pyx_v_J;
16762  __pyx_t_9 = -1;
16763  if (__pyx_t_16 < 0) {
16764  __pyx_t_16 += __pyx_pybuffernd_df_dofs.diminfo[0].shape;
16765  if (unlikely(__pyx_t_16 < 0)) __pyx_t_9 = 0;
16766  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_df_dofs.diminfo[0].shape)) __pyx_t_9 = 0;
16767  if (unlikely(__pyx_t_9 != -1)) {
16768  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16769  __PYX_ERR(0, 773, __pyx_L1_error)
16770  }
16771  __pyx_t_17 = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_df_dofs.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_df_dofs.diminfo[0].strides)) * __pyx_v_vol_e);
16772  __pyx_t_18 = (__pyx_v_omega_e + 1.0e-12);
16773  if (unlikely(__pyx_t_18 == 0)) {
16774  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
16775  __PYX_ERR(0, 773, __pyx_L1_error)
16776  }
16777  __pyx_t_19 = __pyx_v_J;
16778  __pyx_t_9 = -1;
16779  if (__pyx_t_19 < 0) {
16780  __pyx_t_19 += __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].shape;
16781  if (unlikely(__pyx_t_19 < 0)) __pyx_t_9 = 0;
16782  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].shape)) __pyx_t_9 = 0;
16783  if (unlikely(__pyx_t_9 != -1)) {
16784  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16785  __PYX_ERR(0, 773, __pyx_L1_error)
16786  }
16787  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].strides) = (__pyx_t_17 / __pyx_t_18);
16788  }
16789  }
16790 
16791  /* "subsurfaceTransportFunctions.pyx":753
16792  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
16793  *
16794  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
16795  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
16796  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
16797  */
16798 
16799  /* function exit code */
16800  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16801  goto __pyx_L0;
16802  __pyx_L1_error:;
16803  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
16804  __Pyx_PyThreadState_declare
16805  __Pyx_PyThreadState_assign
16806  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
16807  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer);
16808  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
16809  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df_dofs.rcbuffer->pybuffer);
16810  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
16811  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_l2g.rcbuffer->pybuffer);
16812  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
16813  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromVelocityDOFs", __pyx_clineno, __pyx_lineno, __pyx_filename);
16814  __pyx_r = NULL;
16815  goto __pyx_L2;
16816  __pyx_L0:;
16817  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer);
16818  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
16819  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df_dofs.rcbuffer->pybuffer);
16820  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
16821  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_l2g.rcbuffer->pybuffer);
16822  __pyx_L2:;
16823  __Pyx_XGIVEREF(__pyx_r);
16824  __Pyx_RefNannyFinishContext();
16825  return __pyx_r;
16826 }
16827 
16828 /* "subsurfaceTransportFunctions.pyx":776
16829  *
16830  * #problem specific velocity evaluation
16831  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
16832  * double t,
16833  * double tForReversal,
16834  */
16835 
16836 /* Python wrapper */
16837 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
16838 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3 = {"rotatingGaussianElementVelocityEval3", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3, METH_VARARGS|METH_KEYWORDS, 0};
16839 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
16840  int __pyx_v_transient;
16841  double __pyx_v_t;
16842  double __pyx_v_tForReversal;
16843  double __pyx_v_clock;
16844  double __pyx_v_xc;
16845  double __pyx_v_yc;
16846  PyArrayObject *__pyx_v_x = 0;
16847  PyArrayObject *__pyx_v_v = 0;
16848  double __pyx_v_zvelocity;
16849  PyObject *__pyx_r = 0;
16850  __Pyx_RefNannyDeclarations
16851  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval3 (wrapper)", 0);
16852  {
16853  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,&__pyx_n_s_zvelocity,0};
16854  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
16855  if (unlikely(__pyx_kwds)) {
16856  Py_ssize_t kw_args;
16857  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
16858  switch (pos_args) {
16859  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
16860  CYTHON_FALLTHROUGH;
16861  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
16862  CYTHON_FALLTHROUGH;
16863  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
16864  CYTHON_FALLTHROUGH;
16865  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
16866  CYTHON_FALLTHROUGH;
16867  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16868  CYTHON_FALLTHROUGH;
16869  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16870  CYTHON_FALLTHROUGH;
16871  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16872  CYTHON_FALLTHROUGH;
16873  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16874  CYTHON_FALLTHROUGH;
16875  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16876  CYTHON_FALLTHROUGH;
16877  case 0: break;
16878  default: goto __pyx_L5_argtuple_error;
16879  }
16880  kw_args = PyDict_Size(__pyx_kwds);
16881  switch (pos_args) {
16882  case 0:
16883  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
16884  else goto __pyx_L5_argtuple_error;
16885  CYTHON_FALLTHROUGH;
16886  case 1:
16887  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
16888  else {
16889  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 1); __PYX_ERR(0, 776, __pyx_L3_error)
16890  }
16891  CYTHON_FALLTHROUGH;
16892  case 2:
16893  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
16894  else {
16895  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 2); __PYX_ERR(0, 776, __pyx_L3_error)
16896  }
16897  CYTHON_FALLTHROUGH;
16898  case 3:
16899  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
16900  else {
16901  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 3); __PYX_ERR(0, 776, __pyx_L3_error)
16902  }
16903  CYTHON_FALLTHROUGH;
16904  case 4:
16905  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
16906  else {
16907  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 4); __PYX_ERR(0, 776, __pyx_L3_error)
16908  }
16909  CYTHON_FALLTHROUGH;
16910  case 5:
16911  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
16912  else {
16913  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 5); __PYX_ERR(0, 776, __pyx_L3_error)
16914  }
16915  CYTHON_FALLTHROUGH;
16916  case 6:
16917  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
16918  else {
16919  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 6); __PYX_ERR(0, 776, __pyx_L3_error)
16920  }
16921  CYTHON_FALLTHROUGH;
16922  case 7:
16923  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
16924  else {
16925  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 7); __PYX_ERR(0, 776, __pyx_L3_error)
16926  }
16927  CYTHON_FALLTHROUGH;
16928  case 8:
16929  if (kw_args > 0) {
16930  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zvelocity);
16931  if (value) { values[8] = value; kw_args--; }
16932  }
16933  }
16934  if (unlikely(kw_args > 0)) {
16935  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rotatingGaussianElementVelocityEval3") < 0)) __PYX_ERR(0, 776, __pyx_L3_error)
16936  }
16937  } else {
16938  switch (PyTuple_GET_SIZE(__pyx_args)) {
16939  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
16940  CYTHON_FALLTHROUGH;
16941  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
16942  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
16943  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
16944  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16945  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16946  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16947  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16948  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16949  break;
16950  default: goto __pyx_L5_argtuple_error;
16951  }
16952  }
16953  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 776, __pyx_L3_error)
16954  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 777, __pyx_L3_error)
16955  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 778, __pyx_L3_error)
16956  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 779, __pyx_L3_error)
16957  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L3_error)
16958  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L3_error)
16959  __pyx_v_x = ((PyArrayObject *)values[6]);
16960  __pyx_v_v = ((PyArrayObject *)values[7]);
16961  if (values[8]) {
16962  __pyx_v_zvelocity = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_zvelocity == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 783, __pyx_L3_error)
16963  } else {
16964  __pyx_v_zvelocity = ((double)0.0);
16965  }
16966  }
16967  goto __pyx_L4_argument_unpacking_done;
16968  __pyx_L5_argtuple_error:;
16969  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 776, __pyx_L3_error)
16970  __pyx_L3_error:;
16971  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
16972  __Pyx_RefNannyFinishContext();
16973  return NULL;
16974  __pyx_L4_argument_unpacking_done:;
16975  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 781, __pyx_L1_error)
16976  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 782, __pyx_L1_error)
16977  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_46rotatingGaussianElementVelocityEval3(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v, __pyx_v_zvelocity);
16978 
16979  /* function exit code */
16980  goto __pyx_L0;
16981  __pyx_L1_error:;
16982  __pyx_r = NULL;
16983  __pyx_L0:;
16984  __Pyx_RefNannyFinishContext();
16985  return __pyx_r;
16986 }
16987 
16988 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_46rotatingGaussianElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity) {
16989  int __pyx_v_eN;
16990  int __pyx_v_k;
16991  double __pyx_v_pi;
16992  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
16993  __Pyx_Buffer __pyx_pybuffer_v;
16994  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
16995  __Pyx_Buffer __pyx_pybuffer_x;
16996  PyObject *__pyx_r = NULL;
16997  __Pyx_RefNannyDeclarations
16998  int __pyx_t_1;
16999  npy_intp __pyx_t_2;
17000  npy_intp __pyx_t_3;
17001  int __pyx_t_4;
17002  npy_intp __pyx_t_5;
17003  npy_intp __pyx_t_6;
17004  int __pyx_t_7;
17005  Py_ssize_t __pyx_t_8;
17006  Py_ssize_t __pyx_t_9;
17007  Py_ssize_t __pyx_t_10;
17008  int __pyx_t_11;
17009  Py_ssize_t __pyx_t_12;
17010  Py_ssize_t __pyx_t_13;
17011  Py_ssize_t __pyx_t_14;
17012  Py_ssize_t __pyx_t_15;
17013  Py_ssize_t __pyx_t_16;
17014  Py_ssize_t __pyx_t_17;
17015  Py_ssize_t __pyx_t_18;
17016  Py_ssize_t __pyx_t_19;
17017  Py_ssize_t __pyx_t_20;
17018  Py_ssize_t __pyx_t_21;
17019  Py_ssize_t __pyx_t_22;
17020  Py_ssize_t __pyx_t_23;
17021  PyObject *__pyx_t_24 = NULL;
17022  PyObject *__pyx_t_25 = NULL;
17023  PyObject *__pyx_t_26 = NULL;
17024  double __pyx_t_27;
17025  double __pyx_t_28;
17026  PyObject *__pyx_t_29 = NULL;
17027  Py_ssize_t __pyx_t_30;
17028  Py_ssize_t __pyx_t_31;
17029  Py_ssize_t __pyx_t_32;
17030  Py_ssize_t __pyx_t_33;
17031  Py_ssize_t __pyx_t_34;
17032  Py_ssize_t __pyx_t_35;
17033  Py_ssize_t __pyx_t_36;
17034  Py_ssize_t __pyx_t_37;
17035  Py_ssize_t __pyx_t_38;
17036  Py_ssize_t __pyx_t_39;
17037  Py_ssize_t __pyx_t_40;
17038  Py_ssize_t __pyx_t_41;
17039  Py_ssize_t __pyx_t_42;
17040  Py_ssize_t __pyx_t_43;
17041  Py_ssize_t __pyx_t_44;
17042  Py_ssize_t __pyx_t_45;
17043  Py_ssize_t __pyx_t_46;
17044  Py_ssize_t __pyx_t_47;
17045  Py_ssize_t __pyx_t_48;
17046  Py_ssize_t __pyx_t_49;
17047  Py_ssize_t __pyx_t_50;
17048  Py_ssize_t __pyx_t_51;
17049  Py_ssize_t __pyx_t_52;
17050  Py_ssize_t __pyx_t_53;
17051  Py_ssize_t __pyx_t_54;
17052  Py_ssize_t __pyx_t_55;
17053  Py_ssize_t __pyx_t_56;
17054  Py_ssize_t __pyx_t_57;
17055  Py_ssize_t __pyx_t_58;
17056  Py_ssize_t __pyx_t_59;
17057  Py_ssize_t __pyx_t_60;
17058  Py_ssize_t __pyx_t_61;
17059  Py_ssize_t __pyx_t_62;
17060  Py_ssize_t __pyx_t_63;
17061  Py_ssize_t __pyx_t_64;
17062  Py_ssize_t __pyx_t_65;
17063  Py_ssize_t __pyx_t_66;
17064  Py_ssize_t __pyx_t_67;
17065  Py_ssize_t __pyx_t_68;
17066  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval3", 0);
17067  __pyx_pybuffer_x.pybuffer.buf = NULL;
17068  __pyx_pybuffer_x.refcount = 0;
17069  __pyx_pybuffernd_x.data = NULL;
17070  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
17071  __pyx_pybuffer_v.pybuffer.buf = NULL;
17072  __pyx_pybuffer_v.refcount = 0;
17073  __pyx_pybuffernd_v.data = NULL;
17074  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
17075  {
17076  __Pyx_BufFmt_StackElem __pyx_stack[1];
17077  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 776, __pyx_L1_error)
17078  }
17079  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
17080  {
17081  __Pyx_BufFmt_StackElem __pyx_stack[1];
17082  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 776, __pyx_L1_error)
17083  }
17084  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
17085 
17086  /* "subsurfaceTransportFunctions.pyx":786
17087  * cdef int eN,k
17088  * cdef double pi
17089  * pi = M_PI # <<<<<<<<<<<<<<
17090  * if v.shape[2] == 3:
17091  * if transient == 1:
17092  */
17093  __pyx_v_pi = M_PI;
17094 
17095  /* "subsurfaceTransportFunctions.pyx":787
17096  * cdef double pi
17097  * pi = M_PI
17098  * if v.shape[2] == 3: # <<<<<<<<<<<<<<
17099  * if transient == 1:
17100  * for eN in range(x.shape[0]):
17101  */
17102  __pyx_t_1 = (((__pyx_v_v->dimensions[2]) == 3) != 0);
17103  if (__pyx_t_1) {
17104 
17105  /* "subsurfaceTransportFunctions.pyx":788
17106  * pi = M_PI
17107  * if v.shape[2] == 3:
17108  * if transient == 1: # <<<<<<<<<<<<<<
17109  * for eN in range(x.shape[0]):
17110  * for k in range(x.shape[1]):
17111  */
17112  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
17113  if (__pyx_t_1) {
17114 
17115  /* "subsurfaceTransportFunctions.pyx":789
17116  * if v.shape[2] == 3:
17117  * if transient == 1:
17118  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17119  * for k in range(x.shape[1]):
17120  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17121  */
17122  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17123  __pyx_t_3 = __pyx_t_2;
17124  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17125  __pyx_v_eN = __pyx_t_4;
17126 
17127  /* "subsurfaceTransportFunctions.pyx":790
17128  * if transient == 1:
17129  * for eN in range(x.shape[0]):
17130  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
17131  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17132  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17133  */
17134  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
17135  __pyx_t_6 = __pyx_t_5;
17136  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17137  __pyx_v_k = __pyx_t_7;
17138 
17139  /* "subsurfaceTransportFunctions.pyx":791
17140  * for eN in range(x.shape[0]):
17141  * for k in range(x.shape[1]):
17142  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
17143  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17144  * v[eN,k,2]=zvelocity
17145  */
17146  __pyx_t_8 = __pyx_v_eN;
17147  __pyx_t_9 = __pyx_v_k;
17148  __pyx_t_10 = 1;
17149  __pyx_t_11 = -1;
17150  if (__pyx_t_8 < 0) {
17151  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
17152  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
17153  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17154  if (__pyx_t_9 < 0) {
17155  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17156  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17157  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17158  if (__pyx_t_10 < 0) {
17159  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
17160  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
17161  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17162  if (unlikely(__pyx_t_11 != -1)) {
17163  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17164  __PYX_ERR(0, 791, __pyx_L1_error)
17165  }
17166  __pyx_t_12 = __pyx_v_eN;
17167  __pyx_t_13 = __pyx_v_k;
17168  __pyx_t_14 = 0;
17169  __pyx_t_11 = -1;
17170  if (__pyx_t_12 < 0) {
17171  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[0].shape;
17172  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
17173  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17174  if (__pyx_t_13 < 0) {
17175  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17176  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17177  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17178  if (__pyx_t_14 < 0) {
17179  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[2].shape;
17180  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 2;
17181  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17182  if (unlikely(__pyx_t_11 != -1)) {
17183  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17184  __PYX_ERR(0, 791, __pyx_L1_error)
17185  }
17186  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
17187 
17188  /* "subsurfaceTransportFunctions.pyx":792
17189  * for k in range(x.shape[1]):
17190  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17191  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
17192  * v[eN,k,2]=zvelocity
17193  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17194  */
17195  __pyx_t_15 = __pyx_v_eN;
17196  __pyx_t_16 = __pyx_v_k;
17197  __pyx_t_17 = 0;
17198  __pyx_t_11 = -1;
17199  if (__pyx_t_15 < 0) {
17200  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[0].shape;
17201  if (unlikely(__pyx_t_15 < 0)) __pyx_t_11 = 0;
17202  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17203  if (__pyx_t_16 < 0) {
17204  __pyx_t_16 += __pyx_pybuffernd_x.diminfo[1].shape;
17205  if (unlikely(__pyx_t_16 < 0)) __pyx_t_11 = 1;
17206  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17207  if (__pyx_t_17 < 0) {
17208  __pyx_t_17 += __pyx_pybuffernd_x.diminfo[2].shape;
17209  if (unlikely(__pyx_t_17 < 0)) __pyx_t_11 = 2;
17210  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17211  if (unlikely(__pyx_t_11 != -1)) {
17212  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17213  __PYX_ERR(0, 792, __pyx_L1_error)
17214  }
17215  __pyx_t_18 = __pyx_v_eN;
17216  __pyx_t_19 = __pyx_v_k;
17217  __pyx_t_20 = 1;
17218  __pyx_t_11 = -1;
17219  if (__pyx_t_18 < 0) {
17220  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[0].shape;
17221  if (unlikely(__pyx_t_18 < 0)) __pyx_t_11 = 0;
17222  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17223  if (__pyx_t_19 < 0) {
17224  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[1].shape;
17225  if (unlikely(__pyx_t_19 < 0)) __pyx_t_11 = 1;
17226  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17227  if (__pyx_t_20 < 0) {
17228  __pyx_t_20 += __pyx_pybuffernd_v.diminfo[2].shape;
17229  if (unlikely(__pyx_t_20 < 0)) __pyx_t_11 = 2;
17230  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17231  if (unlikely(__pyx_t_11 != -1)) {
17232  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17233  __PYX_ERR(0, 792, __pyx_L1_error)
17234  }
17235  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_x.diminfo[2].strides))));
17236 
17237  /* "subsurfaceTransportFunctions.pyx":793
17238  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17239  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17240  * v[eN,k,2]=zvelocity # <<<<<<<<<<<<<<
17241  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17242  * else:
17243  */
17244  __pyx_t_21 = __pyx_v_eN;
17245  __pyx_t_22 = __pyx_v_k;
17246  __pyx_t_23 = 2;
17247  __pyx_t_11 = -1;
17248  if (__pyx_t_21 < 0) {
17249  __pyx_t_21 += __pyx_pybuffernd_v.diminfo[0].shape;
17250  if (unlikely(__pyx_t_21 < 0)) __pyx_t_11 = 0;
17251  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17252  if (__pyx_t_22 < 0) {
17253  __pyx_t_22 += __pyx_pybuffernd_v.diminfo[1].shape;
17254  if (unlikely(__pyx_t_22 < 0)) __pyx_t_11 = 1;
17255  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17256  if (__pyx_t_23 < 0) {
17257  __pyx_t_23 += __pyx_pybuffernd_v.diminfo[2].shape;
17258  if (unlikely(__pyx_t_23 < 0)) __pyx_t_11 = 2;
17259  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17260  if (unlikely(__pyx_t_11 != -1)) {
17261  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17262  __PYX_ERR(0, 793, __pyx_L1_error)
17263  }
17264  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_23, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zvelocity;
17265 
17266  /* "subsurfaceTransportFunctions.pyx":794
17267  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17268  * v[eN,k,2]=zvelocity
17269  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
17270  * else:
17271  * for eN in range(x.shape[0]):
17272  */
17273  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 794, __pyx_L1_error)
17274  __Pyx_GOTREF(__pyx_t_24);
17275  __pyx_t_25 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 794, __pyx_L1_error)
17276  __Pyx_GOTREF(__pyx_t_25);
17277  __pyx_t_26 = PyTuple_New(3); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 794, __pyx_L1_error)
17278  __Pyx_GOTREF(__pyx_t_26);
17279  __Pyx_GIVEREF(__pyx_t_24);
17280  PyTuple_SET_ITEM(__pyx_t_26, 0, __pyx_t_24);
17281  __Pyx_GIVEREF(__pyx_t_25);
17282  PyTuple_SET_ITEM(__pyx_t_26, 1, __pyx_t_25);
17283  __Pyx_INCREF(__pyx_slice_);
17284  __Pyx_GIVEREF(__pyx_slice_);
17285  PyTuple_SET_ITEM(__pyx_t_26, 2, __pyx_slice_);
17286  __pyx_t_24 = 0;
17287  __pyx_t_25 = 0;
17288  __pyx_t_25 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_26); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 794, __pyx_L1_error)
17289  __Pyx_GOTREF(__pyx_t_25);
17290  __pyx_t_27 = (__pyx_v_tForReversal - __pyx_v_t);
17291  __pyx_t_28 = (__pyx_v_tForReversal - 0.0);
17292  if (unlikely(__pyx_t_28 == 0)) {
17293  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
17294  __PYX_ERR(0, 794, __pyx_L1_error)
17295  }
17296  __pyx_t_24 = PyFloat_FromDouble(((__pyx_t_27 / __pyx_t_28) * __pyx_v_clock)); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 794, __pyx_L1_error)
17297  __Pyx_GOTREF(__pyx_t_24);
17298  __pyx_t_29 = PyNumber_InPlaceMultiply(__pyx_t_25, __pyx_t_24); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 794, __pyx_L1_error)
17299  __Pyx_GOTREF(__pyx_t_29);
17300  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
17301  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
17302  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_26, __pyx_t_29) < 0)) __PYX_ERR(0, 794, __pyx_L1_error)
17303  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
17304  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
17305  }
17306  }
17307 
17308  /* "subsurfaceTransportFunctions.pyx":788
17309  * pi = M_PI
17310  * if v.shape[2] == 3:
17311  * if transient == 1: # <<<<<<<<<<<<<<
17312  * for eN in range(x.shape[0]):
17313  * for k in range(x.shape[1]):
17314  */
17315  goto __pyx_L4;
17316  }
17317 
17318  /* "subsurfaceTransportFunctions.pyx":796
17319  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17320  * else:
17321  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17322  * for k in range(x.shape[1]):
17323  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17324  */
17325  /*else*/ {
17326  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17327  __pyx_t_3 = __pyx_t_2;
17328  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17329  __pyx_v_eN = __pyx_t_4;
17330 
17331  /* "subsurfaceTransportFunctions.pyx":797
17332  * else:
17333  * for eN in range(x.shape[0]):
17334  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
17335  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17336  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17337  */
17338  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
17339  __pyx_t_6 = __pyx_t_5;
17340  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17341  __pyx_v_k = __pyx_t_7;
17342 
17343  /* "subsurfaceTransportFunctions.pyx":798
17344  * for eN in range(x.shape[0]):
17345  * for k in range(x.shape[1]):
17346  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
17347  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17348  * v[eN,k,2]=zvelocity
17349  */
17350  __pyx_t_30 = __pyx_v_eN;
17351  __pyx_t_31 = __pyx_v_k;
17352  __pyx_t_32 = 1;
17353  __pyx_t_11 = -1;
17354  if (__pyx_t_30 < 0) {
17355  __pyx_t_30 += __pyx_pybuffernd_x.diminfo[0].shape;
17356  if (unlikely(__pyx_t_30 < 0)) __pyx_t_11 = 0;
17357  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17358  if (__pyx_t_31 < 0) {
17359  __pyx_t_31 += __pyx_pybuffernd_x.diminfo[1].shape;
17360  if (unlikely(__pyx_t_31 < 0)) __pyx_t_11 = 1;
17361  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17362  if (__pyx_t_32 < 0) {
17363  __pyx_t_32 += __pyx_pybuffernd_x.diminfo[2].shape;
17364  if (unlikely(__pyx_t_32 < 0)) __pyx_t_11 = 2;
17365  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17366  if (unlikely(__pyx_t_11 != -1)) {
17367  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17368  __PYX_ERR(0, 798, __pyx_L1_error)
17369  }
17370  __pyx_t_33 = __pyx_v_eN;
17371  __pyx_t_34 = __pyx_v_k;
17372  __pyx_t_35 = 0;
17373  __pyx_t_11 = -1;
17374  if (__pyx_t_33 < 0) {
17375  __pyx_t_33 += __pyx_pybuffernd_v.diminfo[0].shape;
17376  if (unlikely(__pyx_t_33 < 0)) __pyx_t_11 = 0;
17377  } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17378  if (__pyx_t_34 < 0) {
17379  __pyx_t_34 += __pyx_pybuffernd_v.diminfo[1].shape;
17380  if (unlikely(__pyx_t_34 < 0)) __pyx_t_11 = 1;
17381  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17382  if (__pyx_t_35 < 0) {
17383  __pyx_t_35 += __pyx_pybuffernd_v.diminfo[2].shape;
17384  if (unlikely(__pyx_t_35 < 0)) __pyx_t_11 = 2;
17385  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17386  if (unlikely(__pyx_t_11 != -1)) {
17387  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17388  __PYX_ERR(0, 798, __pyx_L1_error)
17389  }
17390  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_35, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_32, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
17391 
17392  /* "subsurfaceTransportFunctions.pyx":799
17393  * for k in range(x.shape[1]):
17394  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17395  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
17396  * v[eN,k,2]=zvelocity
17397  * else:
17398  */
17399  __pyx_t_36 = __pyx_v_eN;
17400  __pyx_t_37 = __pyx_v_k;
17401  __pyx_t_38 = 0;
17402  __pyx_t_11 = -1;
17403  if (__pyx_t_36 < 0) {
17404  __pyx_t_36 += __pyx_pybuffernd_x.diminfo[0].shape;
17405  if (unlikely(__pyx_t_36 < 0)) __pyx_t_11 = 0;
17406  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17407  if (__pyx_t_37 < 0) {
17408  __pyx_t_37 += __pyx_pybuffernd_x.diminfo[1].shape;
17409  if (unlikely(__pyx_t_37 < 0)) __pyx_t_11 = 1;
17410  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17411  if (__pyx_t_38 < 0) {
17412  __pyx_t_38 += __pyx_pybuffernd_x.diminfo[2].shape;
17413  if (unlikely(__pyx_t_38 < 0)) __pyx_t_11 = 2;
17414  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17415  if (unlikely(__pyx_t_11 != -1)) {
17416  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17417  __PYX_ERR(0, 799, __pyx_L1_error)
17418  }
17419  __pyx_t_39 = __pyx_v_eN;
17420  __pyx_t_40 = __pyx_v_k;
17421  __pyx_t_41 = 1;
17422  __pyx_t_11 = -1;
17423  if (__pyx_t_39 < 0) {
17424  __pyx_t_39 += __pyx_pybuffernd_v.diminfo[0].shape;
17425  if (unlikely(__pyx_t_39 < 0)) __pyx_t_11 = 0;
17426  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17427  if (__pyx_t_40 < 0) {
17428  __pyx_t_40 += __pyx_pybuffernd_v.diminfo[1].shape;
17429  if (unlikely(__pyx_t_40 < 0)) __pyx_t_11 = 1;
17430  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17431  if (__pyx_t_41 < 0) {
17432  __pyx_t_41 += __pyx_pybuffernd_v.diminfo[2].shape;
17433  if (unlikely(__pyx_t_41 < 0)) __pyx_t_11 = 2;
17434  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17435  if (unlikely(__pyx_t_11 != -1)) {
17436  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17437  __PYX_ERR(0, 799, __pyx_L1_error)
17438  }
17439  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_41, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_38, __pyx_pybuffernd_x.diminfo[2].strides))));
17440 
17441  /* "subsurfaceTransportFunctions.pyx":800
17442  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17443  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17444  * v[eN,k,2]=zvelocity # <<<<<<<<<<<<<<
17445  * else:
17446  * assert v.shape[2] == 2
17447  */
17448  __pyx_t_42 = __pyx_v_eN;
17449  __pyx_t_43 = __pyx_v_k;
17450  __pyx_t_44 = 2;
17451  __pyx_t_11 = -1;
17452  if (__pyx_t_42 < 0) {
17453  __pyx_t_42 += __pyx_pybuffernd_v.diminfo[0].shape;
17454  if (unlikely(__pyx_t_42 < 0)) __pyx_t_11 = 0;
17455  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17456  if (__pyx_t_43 < 0) {
17457  __pyx_t_43 += __pyx_pybuffernd_v.diminfo[1].shape;
17458  if (unlikely(__pyx_t_43 < 0)) __pyx_t_11 = 1;
17459  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17460  if (__pyx_t_44 < 0) {
17461  __pyx_t_44 += __pyx_pybuffernd_v.diminfo[2].shape;
17462  if (unlikely(__pyx_t_44 < 0)) __pyx_t_11 = 2;
17463  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17464  if (unlikely(__pyx_t_11 != -1)) {
17465  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17466  __PYX_ERR(0, 800, __pyx_L1_error)
17467  }
17468  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_44, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zvelocity;
17469  }
17470  }
17471  }
17472  __pyx_L4:;
17473 
17474  /* "subsurfaceTransportFunctions.pyx":787
17475  * cdef double pi
17476  * pi = M_PI
17477  * if v.shape[2] == 3: # <<<<<<<<<<<<<<
17478  * if transient == 1:
17479  * for eN in range(x.shape[0]):
17480  */
17481  goto __pyx_L3;
17482  }
17483 
17484  /* "subsurfaceTransportFunctions.pyx":802
17485  * v[eN,k,2]=zvelocity
17486  * else:
17487  * assert v.shape[2] == 2 # <<<<<<<<<<<<<<
17488  * if transient == 1:
17489  * for eN in range(x.shape[0]):
17490  */
17491  /*else*/ {
17492  #ifndef CYTHON_WITHOUT_ASSERTIONS
17493  if (unlikely(!Py_OptimizeFlag)) {
17494  if (unlikely(!(((__pyx_v_v->dimensions[2]) == 2) != 0))) {
17495  PyErr_SetNone(PyExc_AssertionError);
17496  __PYX_ERR(0, 802, __pyx_L1_error)
17497  }
17498  }
17499  #endif
17500 
17501  /* "subsurfaceTransportFunctions.pyx":803
17502  * else:
17503  * assert v.shape[2] == 2
17504  * if transient == 1: # <<<<<<<<<<<<<<
17505  * for eN in range(x.shape[0]):
17506  * for k in range(x.shape[1]):
17507  */
17508  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
17509  if (__pyx_t_1) {
17510 
17511  /* "subsurfaceTransportFunctions.pyx":804
17512  * assert v.shape[2] == 2
17513  * if transient == 1:
17514  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17515  * for k in range(x.shape[1]):
17516  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17517  */
17518  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17519  __pyx_t_3 = __pyx_t_2;
17520  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17521  __pyx_v_eN = __pyx_t_4;
17522 
17523  /* "subsurfaceTransportFunctions.pyx":805
17524  * if transient == 1:
17525  * for eN in range(x.shape[0]):
17526  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
17527  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17528  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17529  */
17530  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
17531  __pyx_t_6 = __pyx_t_5;
17532  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17533  __pyx_v_k = __pyx_t_7;
17534 
17535  /* "subsurfaceTransportFunctions.pyx":806
17536  * for eN in range(x.shape[0]):
17537  * for k in range(x.shape[1]):
17538  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
17539  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17540  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17541  */
17542  __pyx_t_45 = __pyx_v_eN;
17543  __pyx_t_46 = __pyx_v_k;
17544  __pyx_t_47 = 1;
17545  __pyx_t_11 = -1;
17546  if (__pyx_t_45 < 0) {
17547  __pyx_t_45 += __pyx_pybuffernd_x.diminfo[0].shape;
17548  if (unlikely(__pyx_t_45 < 0)) __pyx_t_11 = 0;
17549  } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17550  if (__pyx_t_46 < 0) {
17551  __pyx_t_46 += __pyx_pybuffernd_x.diminfo[1].shape;
17552  if (unlikely(__pyx_t_46 < 0)) __pyx_t_11 = 1;
17553  } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17554  if (__pyx_t_47 < 0) {
17555  __pyx_t_47 += __pyx_pybuffernd_x.diminfo[2].shape;
17556  if (unlikely(__pyx_t_47 < 0)) __pyx_t_11 = 2;
17557  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17558  if (unlikely(__pyx_t_11 != -1)) {
17559  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17560  __PYX_ERR(0, 806, __pyx_L1_error)
17561  }
17562  __pyx_t_48 = __pyx_v_eN;
17563  __pyx_t_49 = __pyx_v_k;
17564  __pyx_t_50 = 0;
17565  __pyx_t_11 = -1;
17566  if (__pyx_t_48 < 0) {
17567  __pyx_t_48 += __pyx_pybuffernd_v.diminfo[0].shape;
17568  if (unlikely(__pyx_t_48 < 0)) __pyx_t_11 = 0;
17569  } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17570  if (__pyx_t_49 < 0) {
17571  __pyx_t_49 += __pyx_pybuffernd_v.diminfo[1].shape;
17572  if (unlikely(__pyx_t_49 < 0)) __pyx_t_11 = 1;
17573  } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17574  if (__pyx_t_50 < 0) {
17575  __pyx_t_50 += __pyx_pybuffernd_v.diminfo[2].shape;
17576  if (unlikely(__pyx_t_50 < 0)) __pyx_t_11 = 2;
17577  } else if (unlikely(__pyx_t_50 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17578  if (unlikely(__pyx_t_11 != -1)) {
17579  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17580  __PYX_ERR(0, 806, __pyx_L1_error)
17581  }
17582  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_50, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_46, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_47, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
17583 
17584  /* "subsurfaceTransportFunctions.pyx":807
17585  * for k in range(x.shape[1]):
17586  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17587  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
17588  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17589  * else:
17590  */
17591  __pyx_t_51 = __pyx_v_eN;
17592  __pyx_t_52 = __pyx_v_k;
17593  __pyx_t_53 = 0;
17594  __pyx_t_11 = -1;
17595  if (__pyx_t_51 < 0) {
17596  __pyx_t_51 += __pyx_pybuffernd_x.diminfo[0].shape;
17597  if (unlikely(__pyx_t_51 < 0)) __pyx_t_11 = 0;
17598  } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17599  if (__pyx_t_52 < 0) {
17600  __pyx_t_52 += __pyx_pybuffernd_x.diminfo[1].shape;
17601  if (unlikely(__pyx_t_52 < 0)) __pyx_t_11 = 1;
17602  } else if (unlikely(__pyx_t_52 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17603  if (__pyx_t_53 < 0) {
17604  __pyx_t_53 += __pyx_pybuffernd_x.diminfo[2].shape;
17605  if (unlikely(__pyx_t_53 < 0)) __pyx_t_11 = 2;
17606  } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17607  if (unlikely(__pyx_t_11 != -1)) {
17608  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17609  __PYX_ERR(0, 807, __pyx_L1_error)
17610  }
17611  __pyx_t_54 = __pyx_v_eN;
17612  __pyx_t_55 = __pyx_v_k;
17613  __pyx_t_56 = 1;
17614  __pyx_t_11 = -1;
17615  if (__pyx_t_54 < 0) {
17616  __pyx_t_54 += __pyx_pybuffernd_v.diminfo[0].shape;
17617  if (unlikely(__pyx_t_54 < 0)) __pyx_t_11 = 0;
17618  } else if (unlikely(__pyx_t_54 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17619  if (__pyx_t_55 < 0) {
17620  __pyx_t_55 += __pyx_pybuffernd_v.diminfo[1].shape;
17621  if (unlikely(__pyx_t_55 < 0)) __pyx_t_11 = 1;
17622  } else if (unlikely(__pyx_t_55 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17623  if (__pyx_t_56 < 0) {
17624  __pyx_t_56 += __pyx_pybuffernd_v.diminfo[2].shape;
17625  if (unlikely(__pyx_t_56 < 0)) __pyx_t_11 = 2;
17626  } else if (unlikely(__pyx_t_56 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17627  if (unlikely(__pyx_t_11 != -1)) {
17628  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17629  __PYX_ERR(0, 807, __pyx_L1_error)
17630  }
17631  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_55, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_56, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_52, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_53, __pyx_pybuffernd_x.diminfo[2].strides))));
17632 
17633  /* "subsurfaceTransportFunctions.pyx":808
17634  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17635  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17636  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
17637  * else:
17638  * for eN in range(x.shape[0]):
17639  */
17640  __pyx_t_26 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 808, __pyx_L1_error)
17641  __Pyx_GOTREF(__pyx_t_26);
17642  __pyx_t_29 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 808, __pyx_L1_error)
17643  __Pyx_GOTREF(__pyx_t_29);
17644  __pyx_t_24 = PyTuple_New(3); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 808, __pyx_L1_error)
17645  __Pyx_GOTREF(__pyx_t_24);
17646  __Pyx_GIVEREF(__pyx_t_26);
17647  PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_26);
17648  __Pyx_GIVEREF(__pyx_t_29);
17649  PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_29);
17650  __Pyx_INCREF(__pyx_slice_);
17651  __Pyx_GIVEREF(__pyx_slice_);
17652  PyTuple_SET_ITEM(__pyx_t_24, 2, __pyx_slice_);
17653  __pyx_t_26 = 0;
17654  __pyx_t_29 = 0;
17655  __pyx_t_29 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_24); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 808, __pyx_L1_error)
17656  __Pyx_GOTREF(__pyx_t_29);
17657  __pyx_t_28 = (__pyx_v_tForReversal - __pyx_v_t);
17658  __pyx_t_27 = (__pyx_v_tForReversal - 0.0);
17659  if (unlikely(__pyx_t_27 == 0)) {
17660  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
17661  __PYX_ERR(0, 808, __pyx_L1_error)
17662  }
17663  __pyx_t_26 = PyFloat_FromDouble(((__pyx_t_28 / __pyx_t_27) * __pyx_v_clock)); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 808, __pyx_L1_error)
17664  __Pyx_GOTREF(__pyx_t_26);
17665  __pyx_t_25 = PyNumber_InPlaceMultiply(__pyx_t_29, __pyx_t_26); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 808, __pyx_L1_error)
17666  __Pyx_GOTREF(__pyx_t_25);
17667  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
17668  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
17669  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_24, __pyx_t_25) < 0)) __PYX_ERR(0, 808, __pyx_L1_error)
17670  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
17671  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
17672  }
17673  }
17674 
17675  /* "subsurfaceTransportFunctions.pyx":803
17676  * else:
17677  * assert v.shape[2] == 2
17678  * if transient == 1: # <<<<<<<<<<<<<<
17679  * for eN in range(x.shape[0]):
17680  * for k in range(x.shape[1]):
17681  */
17682  goto __pyx_L13;
17683  }
17684 
17685  /* "subsurfaceTransportFunctions.pyx":810
17686  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17687  * else:
17688  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17689  * for k in range(x.shape[1]):
17690  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17691  */
17692  /*else*/ {
17693  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17694  __pyx_t_3 = __pyx_t_2;
17695  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17696  __pyx_v_eN = __pyx_t_4;
17697 
17698  /* "subsurfaceTransportFunctions.pyx":811
17699  * else:
17700  * for eN in range(x.shape[0]):
17701  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
17702  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17703  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17704  */
17705  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
17706  __pyx_t_6 = __pyx_t_5;
17707  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17708  __pyx_v_k = __pyx_t_7;
17709 
17710  /* "subsurfaceTransportFunctions.pyx":812
17711  * for eN in range(x.shape[0]):
17712  * for k in range(x.shape[1]):
17713  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
17714  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17715  *
17716  */
17717  __pyx_t_57 = __pyx_v_eN;
17718  __pyx_t_58 = __pyx_v_k;
17719  __pyx_t_59 = 1;
17720  __pyx_t_11 = -1;
17721  if (__pyx_t_57 < 0) {
17722  __pyx_t_57 += __pyx_pybuffernd_x.diminfo[0].shape;
17723  if (unlikely(__pyx_t_57 < 0)) __pyx_t_11 = 0;
17724  } else if (unlikely(__pyx_t_57 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17725  if (__pyx_t_58 < 0) {
17726  __pyx_t_58 += __pyx_pybuffernd_x.diminfo[1].shape;
17727  if (unlikely(__pyx_t_58 < 0)) __pyx_t_11 = 1;
17728  } else if (unlikely(__pyx_t_58 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17729  if (__pyx_t_59 < 0) {
17730  __pyx_t_59 += __pyx_pybuffernd_x.diminfo[2].shape;
17731  if (unlikely(__pyx_t_59 < 0)) __pyx_t_11 = 2;
17732  } else if (unlikely(__pyx_t_59 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17733  if (unlikely(__pyx_t_11 != -1)) {
17734  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17735  __PYX_ERR(0, 812, __pyx_L1_error)
17736  }
17737  __pyx_t_60 = __pyx_v_eN;
17738  __pyx_t_61 = __pyx_v_k;
17739  __pyx_t_62 = 0;
17740  __pyx_t_11 = -1;
17741  if (__pyx_t_60 < 0) {
17742  __pyx_t_60 += __pyx_pybuffernd_v.diminfo[0].shape;
17743  if (unlikely(__pyx_t_60 < 0)) __pyx_t_11 = 0;
17744  } else if (unlikely(__pyx_t_60 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17745  if (__pyx_t_61 < 0) {
17746  __pyx_t_61 += __pyx_pybuffernd_v.diminfo[1].shape;
17747  if (unlikely(__pyx_t_61 < 0)) __pyx_t_11 = 1;
17748  } else if (unlikely(__pyx_t_61 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17749  if (__pyx_t_62 < 0) {
17750  __pyx_t_62 += __pyx_pybuffernd_v.diminfo[2].shape;
17751  if (unlikely(__pyx_t_62 < 0)) __pyx_t_11 = 2;
17752  } else if (unlikely(__pyx_t_62 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17753  if (unlikely(__pyx_t_11 != -1)) {
17754  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17755  __PYX_ERR(0, 812, __pyx_L1_error)
17756  }
17757  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_60, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_61, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_62, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_58, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_59, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
17758 
17759  /* "subsurfaceTransportFunctions.pyx":813
17760  * for k in range(x.shape[1]):
17761  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17762  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
17763  *
17764  *
17765  */
17766  __pyx_t_63 = __pyx_v_eN;
17767  __pyx_t_64 = __pyx_v_k;
17768  __pyx_t_65 = 0;
17769  __pyx_t_11 = -1;
17770  if (__pyx_t_63 < 0) {
17771  __pyx_t_63 += __pyx_pybuffernd_x.diminfo[0].shape;
17772  if (unlikely(__pyx_t_63 < 0)) __pyx_t_11 = 0;
17773  } else if (unlikely(__pyx_t_63 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17774  if (__pyx_t_64 < 0) {
17775  __pyx_t_64 += __pyx_pybuffernd_x.diminfo[1].shape;
17776  if (unlikely(__pyx_t_64 < 0)) __pyx_t_11 = 1;
17777  } else if (unlikely(__pyx_t_64 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17778  if (__pyx_t_65 < 0) {
17779  __pyx_t_65 += __pyx_pybuffernd_x.diminfo[2].shape;
17780  if (unlikely(__pyx_t_65 < 0)) __pyx_t_11 = 2;
17781  } else if (unlikely(__pyx_t_65 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17782  if (unlikely(__pyx_t_11 != -1)) {
17783  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17784  __PYX_ERR(0, 813, __pyx_L1_error)
17785  }
17786  __pyx_t_66 = __pyx_v_eN;
17787  __pyx_t_67 = __pyx_v_k;
17788  __pyx_t_68 = 1;
17789  __pyx_t_11 = -1;
17790  if (__pyx_t_66 < 0) {
17791  __pyx_t_66 += __pyx_pybuffernd_v.diminfo[0].shape;
17792  if (unlikely(__pyx_t_66 < 0)) __pyx_t_11 = 0;
17793  } else if (unlikely(__pyx_t_66 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17794  if (__pyx_t_67 < 0) {
17795  __pyx_t_67 += __pyx_pybuffernd_v.diminfo[1].shape;
17796  if (unlikely(__pyx_t_67 < 0)) __pyx_t_11 = 1;
17797  } else if (unlikely(__pyx_t_67 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17798  if (__pyx_t_68 < 0) {
17799  __pyx_t_68 += __pyx_pybuffernd_v.diminfo[2].shape;
17800  if (unlikely(__pyx_t_68 < 0)) __pyx_t_11 = 2;
17801  } else if (unlikely(__pyx_t_68 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17802  if (unlikely(__pyx_t_11 != -1)) {
17803  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17804  __PYX_ERR(0, 813, __pyx_L1_error)
17805  }
17806  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_66, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_67, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_68, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_63, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_64, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_65, __pyx_pybuffernd_x.diminfo[2].strides))));
17807  }
17808  }
17809  }
17810  __pyx_L13:;
17811  }
17812  __pyx_L3:;
17813 
17814  /* "subsurfaceTransportFunctions.pyx":776
17815  *
17816  * #problem specific velocity evaluation
17817  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
17818  * double t,
17819  * double tForReversal,
17820  */
17821 
17822  /* function exit code */
17823  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17824  goto __pyx_L0;
17825  __pyx_L1_error:;
17826  __Pyx_XDECREF(__pyx_t_24);
17827  __Pyx_XDECREF(__pyx_t_25);
17828  __Pyx_XDECREF(__pyx_t_26);
17829  __Pyx_XDECREF(__pyx_t_29);
17830  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
17831  __Pyx_PyThreadState_declare
17832  __Pyx_PyThreadState_assign
17833  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
17834  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
17835  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
17836  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
17837  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
17838  __pyx_r = NULL;
17839  goto __pyx_L2;
17840  __pyx_L0:;
17841  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
17842  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
17843  __pyx_L2:;
17844  __Pyx_XGIVEREF(__pyx_r);
17845  __Pyx_RefNannyFinishContext();
17846  return __pyx_r;
17847 }
17848 
17849 /* "subsurfaceTransportFunctions.pyx":816
17850  *
17851  *
17852  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
17853  * double t,
17854  * double tForReversal,
17855  */
17856 
17857 /* Python wrapper */
17858 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
17859 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4 = {"rotatingGaussianElementVelocityEval4", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4, METH_VARARGS|METH_KEYWORDS, 0};
17860 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
17861  int __pyx_v_transient;
17862  double __pyx_v_t;
17863  double __pyx_v_tForReversal;
17864  double __pyx_v_clock;
17865  double __pyx_v_xc;
17866  double __pyx_v_yc;
17867  PyArrayObject *__pyx_v_x = 0;
17868  PyArrayObject *__pyx_v_v = 0;
17869  double __pyx_v_zvelocity;
17870  PyObject *__pyx_r = 0;
17871  __Pyx_RefNannyDeclarations
17872  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval4 (wrapper)", 0);
17873  {
17874  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,&__pyx_n_s_zvelocity,0};
17875  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
17876  if (unlikely(__pyx_kwds)) {
17877  Py_ssize_t kw_args;
17878  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
17879  switch (pos_args) {
17880  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
17881  CYTHON_FALLTHROUGH;
17882  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
17883  CYTHON_FALLTHROUGH;
17884  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
17885  CYTHON_FALLTHROUGH;
17886  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
17887  CYTHON_FALLTHROUGH;
17888  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
17889  CYTHON_FALLTHROUGH;
17890  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
17891  CYTHON_FALLTHROUGH;
17892  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17893  CYTHON_FALLTHROUGH;
17894  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17895  CYTHON_FALLTHROUGH;
17896  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17897  CYTHON_FALLTHROUGH;
17898  case 0: break;
17899  default: goto __pyx_L5_argtuple_error;
17900  }
17901  kw_args = PyDict_Size(__pyx_kwds);
17902  switch (pos_args) {
17903  case 0:
17904  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
17905  else goto __pyx_L5_argtuple_error;
17906  CYTHON_FALLTHROUGH;
17907  case 1:
17908  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
17909  else {
17910  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 1); __PYX_ERR(0, 816, __pyx_L3_error)
17911  }
17912  CYTHON_FALLTHROUGH;
17913  case 2:
17914  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
17915  else {
17916  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 2); __PYX_ERR(0, 816, __pyx_L3_error)
17917  }
17918  CYTHON_FALLTHROUGH;
17919  case 3:
17920  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
17921  else {
17922  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 3); __PYX_ERR(0, 816, __pyx_L3_error)
17923  }
17924  CYTHON_FALLTHROUGH;
17925  case 4:
17926  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
17927  else {
17928  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 4); __PYX_ERR(0, 816, __pyx_L3_error)
17929  }
17930  CYTHON_FALLTHROUGH;
17931  case 5:
17932  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
17933  else {
17934  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 5); __PYX_ERR(0, 816, __pyx_L3_error)
17935  }
17936  CYTHON_FALLTHROUGH;
17937  case 6:
17938  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
17939  else {
17940  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 6); __PYX_ERR(0, 816, __pyx_L3_error)
17941  }
17942  CYTHON_FALLTHROUGH;
17943  case 7:
17944  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
17945  else {
17946  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 7); __PYX_ERR(0, 816, __pyx_L3_error)
17947  }
17948  CYTHON_FALLTHROUGH;
17949  case 8:
17950  if (kw_args > 0) {
17951  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zvelocity);
17952  if (value) { values[8] = value; kw_args--; }
17953  }
17954  }
17955  if (unlikely(kw_args > 0)) {
17956  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rotatingGaussianElementVelocityEval4") < 0)) __PYX_ERR(0, 816, __pyx_L3_error)
17957  }
17958  } else {
17959  switch (PyTuple_GET_SIZE(__pyx_args)) {
17960  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
17961  CYTHON_FALLTHROUGH;
17962  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
17963  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
17964  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
17965  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
17966  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
17967  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17968  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17969  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17970  break;
17971  default: goto __pyx_L5_argtuple_error;
17972  }
17973  }
17974  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 816, __pyx_L3_error)
17975  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 817, __pyx_L3_error)
17976  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 818, __pyx_L3_error)
17977  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 819, __pyx_L3_error)
17978  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 820, __pyx_L3_error)
17979  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 820, __pyx_L3_error)
17980  __pyx_v_x = ((PyArrayObject *)values[6]);
17981  __pyx_v_v = ((PyArrayObject *)values[7]);
17982  if (values[8]) {
17983  __pyx_v_zvelocity = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_zvelocity == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 823, __pyx_L3_error)
17984  } else {
17985  __pyx_v_zvelocity = ((double)0.0);
17986  }
17987  }
17988  goto __pyx_L4_argument_unpacking_done;
17989  __pyx_L5_argtuple_error:;
17990  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 816, __pyx_L3_error)
17991  __pyx_L3_error:;
17992  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
17993  __Pyx_RefNannyFinishContext();
17994  return NULL;
17995  __pyx_L4_argument_unpacking_done:;
17996  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 821, __pyx_L1_error)
17997  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 822, __pyx_L1_error)
17998  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_48rotatingGaussianElementVelocityEval4(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v, __pyx_v_zvelocity);
17999 
18000  /* function exit code */
18001  goto __pyx_L0;
18002  __pyx_L1_error:;
18003  __pyx_r = NULL;
18004  __pyx_L0:;
18005  __Pyx_RefNannyFinishContext();
18006  return __pyx_r;
18007 }
18008 
18009 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_48rotatingGaussianElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity) {
18010  int __pyx_v_eN;
18011  int __pyx_v_ebN;
18012  int __pyx_v_k;
18013  double __pyx_v_pi;
18014  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
18015  __Pyx_Buffer __pyx_pybuffer_v;
18016  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
18017  __Pyx_Buffer __pyx_pybuffer_x;
18018  PyObject *__pyx_r = NULL;
18019  __Pyx_RefNannyDeclarations
18020  int __pyx_t_1;
18021  npy_intp __pyx_t_2;
18022  npy_intp __pyx_t_3;
18023  int __pyx_t_4;
18024  npy_intp __pyx_t_5;
18025  npy_intp __pyx_t_6;
18026  int __pyx_t_7;
18027  npy_intp __pyx_t_8;
18028  npy_intp __pyx_t_9;
18029  int __pyx_t_10;
18030  Py_ssize_t __pyx_t_11;
18031  Py_ssize_t __pyx_t_12;
18032  Py_ssize_t __pyx_t_13;
18033  Py_ssize_t __pyx_t_14;
18034  int __pyx_t_15;
18035  Py_ssize_t __pyx_t_16;
18036  Py_ssize_t __pyx_t_17;
18037  Py_ssize_t __pyx_t_18;
18038  Py_ssize_t __pyx_t_19;
18039  Py_ssize_t __pyx_t_20;
18040  Py_ssize_t __pyx_t_21;
18041  Py_ssize_t __pyx_t_22;
18042  Py_ssize_t __pyx_t_23;
18043  Py_ssize_t __pyx_t_24;
18044  Py_ssize_t __pyx_t_25;
18045  Py_ssize_t __pyx_t_26;
18046  Py_ssize_t __pyx_t_27;
18047  Py_ssize_t __pyx_t_28;
18048  Py_ssize_t __pyx_t_29;
18049  Py_ssize_t __pyx_t_30;
18050  Py_ssize_t __pyx_t_31;
18051  PyObject *__pyx_t_32 = NULL;
18052  PyObject *__pyx_t_33 = NULL;
18053  PyObject *__pyx_t_34 = NULL;
18054  PyObject *__pyx_t_35 = NULL;
18055  double __pyx_t_36;
18056  double __pyx_t_37;
18057  Py_ssize_t __pyx_t_38;
18058  Py_ssize_t __pyx_t_39;
18059  Py_ssize_t __pyx_t_40;
18060  Py_ssize_t __pyx_t_41;
18061  Py_ssize_t __pyx_t_42;
18062  Py_ssize_t __pyx_t_43;
18063  Py_ssize_t __pyx_t_44;
18064  Py_ssize_t __pyx_t_45;
18065  Py_ssize_t __pyx_t_46;
18066  Py_ssize_t __pyx_t_47;
18067  Py_ssize_t __pyx_t_48;
18068  Py_ssize_t __pyx_t_49;
18069  Py_ssize_t __pyx_t_50;
18070  Py_ssize_t __pyx_t_51;
18071  Py_ssize_t __pyx_t_52;
18072  Py_ssize_t __pyx_t_53;
18073  Py_ssize_t __pyx_t_54;
18074  Py_ssize_t __pyx_t_55;
18075  Py_ssize_t __pyx_t_56;
18076  Py_ssize_t __pyx_t_57;
18077  Py_ssize_t __pyx_t_58;
18078  Py_ssize_t __pyx_t_59;
18079  Py_ssize_t __pyx_t_60;
18080  Py_ssize_t __pyx_t_61;
18081  Py_ssize_t __pyx_t_62;
18082  Py_ssize_t __pyx_t_63;
18083  Py_ssize_t __pyx_t_64;
18084  Py_ssize_t __pyx_t_65;
18085  Py_ssize_t __pyx_t_66;
18086  Py_ssize_t __pyx_t_67;
18087  Py_ssize_t __pyx_t_68;
18088  Py_ssize_t __pyx_t_69;
18089  Py_ssize_t __pyx_t_70;
18090  Py_ssize_t __pyx_t_71;
18091  Py_ssize_t __pyx_t_72;
18092  Py_ssize_t __pyx_t_73;
18093  Py_ssize_t __pyx_t_74;
18094  Py_ssize_t __pyx_t_75;
18095  Py_ssize_t __pyx_t_76;
18096  Py_ssize_t __pyx_t_77;
18097  Py_ssize_t __pyx_t_78;
18098  Py_ssize_t __pyx_t_79;
18099  Py_ssize_t __pyx_t_80;
18100  Py_ssize_t __pyx_t_81;
18101  Py_ssize_t __pyx_t_82;
18102  Py_ssize_t __pyx_t_83;
18103  Py_ssize_t __pyx_t_84;
18104  Py_ssize_t __pyx_t_85;
18105  Py_ssize_t __pyx_t_86;
18106  Py_ssize_t __pyx_t_87;
18107  Py_ssize_t __pyx_t_88;
18108  Py_ssize_t __pyx_t_89;
18109  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval4", 0);
18110  __pyx_pybuffer_x.pybuffer.buf = NULL;
18111  __pyx_pybuffer_x.refcount = 0;
18112  __pyx_pybuffernd_x.data = NULL;
18113  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
18114  __pyx_pybuffer_v.pybuffer.buf = NULL;
18115  __pyx_pybuffer_v.refcount = 0;
18116  __pyx_pybuffernd_v.data = NULL;
18117  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
18118  {
18119  __Pyx_BufFmt_StackElem __pyx_stack[1];
18120  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 816, __pyx_L1_error)
18121  }
18122  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
18123  {
18124  __Pyx_BufFmt_StackElem __pyx_stack[1];
18125  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 816, __pyx_L1_error)
18126  }
18127  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
18128 
18129  /* "subsurfaceTransportFunctions.pyx":826
18130  * cdef int eN,ebN,k
18131  * cdef double pi
18132  * pi = M_PI # <<<<<<<<<<<<<<
18133  * if v.shape[v.ndim-1] == 3:
18134  * if transient == 1:
18135  */
18136  __pyx_v_pi = M_PI;
18137 
18138  /* "subsurfaceTransportFunctions.pyx":827
18139  * cdef double pi
18140  * pi = M_PI
18141  * if v.shape[v.ndim-1] == 3: # <<<<<<<<<<<<<<
18142  * if transient == 1:
18143  * for eN in range(x.shape[0]):
18144  */
18145  __pyx_t_1 = (((__pyx_v_v->dimensions[(__pyx_v_v->nd - 1)]) == 3) != 0);
18146  if (__pyx_t_1) {
18147 
18148  /* "subsurfaceTransportFunctions.pyx":828
18149  * pi = M_PI
18150  * if v.shape[v.ndim-1] == 3:
18151  * if transient == 1: # <<<<<<<<<<<<<<
18152  * for eN in range(x.shape[0]):
18153  * for ebN in range(x.shape[1]):
18154  */
18155  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
18156  if (__pyx_t_1) {
18157 
18158  /* "subsurfaceTransportFunctions.pyx":829
18159  * if v.shape[v.ndim-1] == 3:
18160  * if transient == 1:
18161  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18162  * for ebN in range(x.shape[1]):
18163  * for k in range(x.shape[2]):
18164  */
18165  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18166  __pyx_t_3 = __pyx_t_2;
18167  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18168  __pyx_v_eN = __pyx_t_4;
18169 
18170  /* "subsurfaceTransportFunctions.pyx":830
18171  * if transient == 1:
18172  * for eN in range(x.shape[0]):
18173  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
18174  * for k in range(x.shape[2]):
18175  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18176  */
18177  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
18178  __pyx_t_6 = __pyx_t_5;
18179  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
18180  __pyx_v_ebN = __pyx_t_7;
18181 
18182  /* "subsurfaceTransportFunctions.pyx":831
18183  * for eN in range(x.shape[0]):
18184  * for ebN in range(x.shape[1]):
18185  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
18186  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18187  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18188  */
18189  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
18190  __pyx_t_9 = __pyx_t_8;
18191  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
18192  __pyx_v_k = __pyx_t_10;
18193 
18194  /* "subsurfaceTransportFunctions.pyx":832
18195  * for ebN in range(x.shape[1]):
18196  * for k in range(x.shape[2]):
18197  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
18198  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18199  * v[eN,ebN,k,2]=zvelocity
18200  */
18201  __pyx_t_11 = __pyx_v_eN;
18202  __pyx_t_12 = __pyx_v_ebN;
18203  __pyx_t_13 = __pyx_v_k;
18204  __pyx_t_14 = 1;
18205  __pyx_t_15 = -1;
18206  if (__pyx_t_11 < 0) {
18207  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
18208  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
18209  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18210  if (__pyx_t_12 < 0) {
18211  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
18212  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
18213  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18214  if (__pyx_t_13 < 0) {
18215  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
18216  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
18217  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18218  if (__pyx_t_14 < 0) {
18219  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[3].shape;
18220  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
18221  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18222  if (unlikely(__pyx_t_15 != -1)) {
18223  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18224  __PYX_ERR(0, 832, __pyx_L1_error)
18225  }
18226  __pyx_t_16 = __pyx_v_eN;
18227  __pyx_t_17 = __pyx_v_ebN;
18228  __pyx_t_18 = __pyx_v_k;
18229  __pyx_t_19 = 0;
18230  __pyx_t_15 = -1;
18231  if (__pyx_t_16 < 0) {
18232  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
18233  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
18234  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18235  if (__pyx_t_17 < 0) {
18236  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
18237  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 1;
18238  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18239  if (__pyx_t_18 < 0) {
18240  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
18241  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 2;
18242  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18243  if (__pyx_t_19 < 0) {
18244  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[3].shape;
18245  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 3;
18246  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18247  if (unlikely(__pyx_t_15 != -1)) {
18248  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18249  __PYX_ERR(0, 832, __pyx_L1_error)
18250  }
18251  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
18252 
18253  /* "subsurfaceTransportFunctions.pyx":833
18254  * for k in range(x.shape[2]):
18255  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18256  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
18257  * v[eN,ebN,k,2]=zvelocity
18258  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18259  */
18260  __pyx_t_20 = __pyx_v_eN;
18261  __pyx_t_21 = __pyx_v_ebN;
18262  __pyx_t_22 = __pyx_v_k;
18263  __pyx_t_23 = 0;
18264  __pyx_t_15 = -1;
18265  if (__pyx_t_20 < 0) {
18266  __pyx_t_20 += __pyx_pybuffernd_x.diminfo[0].shape;
18267  if (unlikely(__pyx_t_20 < 0)) __pyx_t_15 = 0;
18268  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18269  if (__pyx_t_21 < 0) {
18270  __pyx_t_21 += __pyx_pybuffernd_x.diminfo[1].shape;
18271  if (unlikely(__pyx_t_21 < 0)) __pyx_t_15 = 1;
18272  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18273  if (__pyx_t_22 < 0) {
18274  __pyx_t_22 += __pyx_pybuffernd_x.diminfo[2].shape;
18275  if (unlikely(__pyx_t_22 < 0)) __pyx_t_15 = 2;
18276  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18277  if (__pyx_t_23 < 0) {
18278  __pyx_t_23 += __pyx_pybuffernd_x.diminfo[3].shape;
18279  if (unlikely(__pyx_t_23 < 0)) __pyx_t_15 = 3;
18280  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18281  if (unlikely(__pyx_t_15 != -1)) {
18282  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18283  __PYX_ERR(0, 833, __pyx_L1_error)
18284  }
18285  __pyx_t_24 = __pyx_v_eN;
18286  __pyx_t_25 = __pyx_v_ebN;
18287  __pyx_t_26 = __pyx_v_k;
18288  __pyx_t_27 = 1;
18289  __pyx_t_15 = -1;
18290  if (__pyx_t_24 < 0) {
18291  __pyx_t_24 += __pyx_pybuffernd_v.diminfo[0].shape;
18292  if (unlikely(__pyx_t_24 < 0)) __pyx_t_15 = 0;
18293  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18294  if (__pyx_t_25 < 0) {
18295  __pyx_t_25 += __pyx_pybuffernd_v.diminfo[1].shape;
18296  if (unlikely(__pyx_t_25 < 0)) __pyx_t_15 = 1;
18297  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18298  if (__pyx_t_26 < 0) {
18299  __pyx_t_26 += __pyx_pybuffernd_v.diminfo[2].shape;
18300  if (unlikely(__pyx_t_26 < 0)) __pyx_t_15 = 2;
18301  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18302  if (__pyx_t_27 < 0) {
18303  __pyx_t_27 += __pyx_pybuffernd_v.diminfo[3].shape;
18304  if (unlikely(__pyx_t_27 < 0)) __pyx_t_15 = 3;
18305  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18306  if (unlikely(__pyx_t_15 != -1)) {
18307  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18308  __PYX_ERR(0, 833, __pyx_L1_error)
18309  }
18310  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_26, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_27, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_22, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_23, __pyx_pybuffernd_x.diminfo[3].strides))));
18311 
18312  /* "subsurfaceTransportFunctions.pyx":834
18313  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18314  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18315  * v[eN,ebN,k,2]=zvelocity # <<<<<<<<<<<<<<
18316  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18317  * else:
18318  */
18319  __pyx_t_28 = __pyx_v_eN;
18320  __pyx_t_29 = __pyx_v_ebN;
18321  __pyx_t_30 = __pyx_v_k;
18322  __pyx_t_31 = 2;
18323  __pyx_t_15 = -1;
18324  if (__pyx_t_28 < 0) {
18325  __pyx_t_28 += __pyx_pybuffernd_v.diminfo[0].shape;
18326  if (unlikely(__pyx_t_28 < 0)) __pyx_t_15 = 0;
18327  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18328  if (__pyx_t_29 < 0) {
18329  __pyx_t_29 += __pyx_pybuffernd_v.diminfo[1].shape;
18330  if (unlikely(__pyx_t_29 < 0)) __pyx_t_15 = 1;
18331  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18332  if (__pyx_t_30 < 0) {
18333  __pyx_t_30 += __pyx_pybuffernd_v.diminfo[2].shape;
18334  if (unlikely(__pyx_t_30 < 0)) __pyx_t_15 = 2;
18335  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18336  if (__pyx_t_31 < 0) {
18337  __pyx_t_31 += __pyx_pybuffernd_v.diminfo[3].shape;
18338  if (unlikely(__pyx_t_31 < 0)) __pyx_t_15 = 3;
18339  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18340  if (unlikely(__pyx_t_15 != -1)) {
18341  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18342  __PYX_ERR(0, 834, __pyx_L1_error)
18343  }
18344  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_30, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_31, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zvelocity;
18345 
18346  /* "subsurfaceTransportFunctions.pyx":835
18347  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18348  * v[eN,ebN,k,2]=zvelocity
18349  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
18350  * else:
18351  * for eN in range(x.shape[0]):
18352  */
18353  __pyx_t_32 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_32)) __PYX_ERR(0, 835, __pyx_L1_error)
18354  __Pyx_GOTREF(__pyx_t_32);
18355  __pyx_t_33 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 835, __pyx_L1_error)
18356  __Pyx_GOTREF(__pyx_t_33);
18357  __pyx_t_34 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 835, __pyx_L1_error)
18358  __Pyx_GOTREF(__pyx_t_34);
18359  __pyx_t_35 = PyTuple_New(4); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 835, __pyx_L1_error)
18360  __Pyx_GOTREF(__pyx_t_35);
18361  __Pyx_GIVEREF(__pyx_t_32);
18362  PyTuple_SET_ITEM(__pyx_t_35, 0, __pyx_t_32);
18363  __Pyx_GIVEREF(__pyx_t_33);
18364  PyTuple_SET_ITEM(__pyx_t_35, 1, __pyx_t_33);
18365  __Pyx_GIVEREF(__pyx_t_34);
18366  PyTuple_SET_ITEM(__pyx_t_35, 2, __pyx_t_34);
18367  __Pyx_INCREF(__pyx_slice_);
18368  __Pyx_GIVEREF(__pyx_slice_);
18369  PyTuple_SET_ITEM(__pyx_t_35, 3, __pyx_slice_);
18370  __pyx_t_32 = 0;
18371  __pyx_t_33 = 0;
18372  __pyx_t_34 = 0;
18373  __pyx_t_34 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_35); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 835, __pyx_L1_error)
18374  __Pyx_GOTREF(__pyx_t_34);
18375  __pyx_t_36 = (__pyx_v_tForReversal - __pyx_v_t);
18376  __pyx_t_37 = (__pyx_v_tForReversal - 0.0);
18377  if (unlikely(__pyx_t_37 == 0)) {
18378  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
18379  __PYX_ERR(0, 835, __pyx_L1_error)
18380  }
18381  __pyx_t_33 = PyFloat_FromDouble(((__pyx_t_36 / __pyx_t_37) * __pyx_v_clock)); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 835, __pyx_L1_error)
18382  __Pyx_GOTREF(__pyx_t_33);
18383  __pyx_t_32 = PyNumber_InPlaceMultiply(__pyx_t_34, __pyx_t_33); if (unlikely(!__pyx_t_32)) __PYX_ERR(0, 835, __pyx_L1_error)
18384  __Pyx_GOTREF(__pyx_t_32);
18385  __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
18386  __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
18387  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_35, __pyx_t_32) < 0)) __PYX_ERR(0, 835, __pyx_L1_error)
18388  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
18389  __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
18390  }
18391  }
18392  }
18393 
18394  /* "subsurfaceTransportFunctions.pyx":828
18395  * pi = M_PI
18396  * if v.shape[v.ndim-1] == 3:
18397  * if transient == 1: # <<<<<<<<<<<<<<
18398  * for eN in range(x.shape[0]):
18399  * for ebN in range(x.shape[1]):
18400  */
18401  goto __pyx_L4;
18402  }
18403 
18404  /* "subsurfaceTransportFunctions.pyx":837
18405  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18406  * else:
18407  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18408  * for ebN in range(x.shape[1]):
18409  * for k in range(x.shape[2]):
18410  */
18411  /*else*/ {
18412  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18413  __pyx_t_3 = __pyx_t_2;
18414  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18415  __pyx_v_eN = __pyx_t_4;
18416 
18417  /* "subsurfaceTransportFunctions.pyx":838
18418  * else:
18419  * for eN in range(x.shape[0]):
18420  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
18421  * for k in range(x.shape[2]):
18422  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18423  */
18424  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
18425  __pyx_t_6 = __pyx_t_5;
18426  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
18427  __pyx_v_ebN = __pyx_t_7;
18428 
18429  /* "subsurfaceTransportFunctions.pyx":839
18430  * for eN in range(x.shape[0]):
18431  * for ebN in range(x.shape[1]):
18432  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
18433  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18434  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18435  */
18436  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
18437  __pyx_t_9 = __pyx_t_8;
18438  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
18439  __pyx_v_k = __pyx_t_10;
18440 
18441  /* "subsurfaceTransportFunctions.pyx":840
18442  * for ebN in range(x.shape[1]):
18443  * for k in range(x.shape[2]):
18444  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
18445  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18446  * v[eN,ebN,k,2]=zvelocity
18447  */
18448  __pyx_t_38 = __pyx_v_eN;
18449  __pyx_t_39 = __pyx_v_ebN;
18450  __pyx_t_40 = __pyx_v_k;
18451  __pyx_t_41 = 1;
18452  __pyx_t_15 = -1;
18453  if (__pyx_t_38 < 0) {
18454  __pyx_t_38 += __pyx_pybuffernd_x.diminfo[0].shape;
18455  if (unlikely(__pyx_t_38 < 0)) __pyx_t_15 = 0;
18456  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18457  if (__pyx_t_39 < 0) {
18458  __pyx_t_39 += __pyx_pybuffernd_x.diminfo[1].shape;
18459  if (unlikely(__pyx_t_39 < 0)) __pyx_t_15 = 1;
18460  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18461  if (__pyx_t_40 < 0) {
18462  __pyx_t_40 += __pyx_pybuffernd_x.diminfo[2].shape;
18463  if (unlikely(__pyx_t_40 < 0)) __pyx_t_15 = 2;
18464  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18465  if (__pyx_t_41 < 0) {
18466  __pyx_t_41 += __pyx_pybuffernd_x.diminfo[3].shape;
18467  if (unlikely(__pyx_t_41 < 0)) __pyx_t_15 = 3;
18468  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18469  if (unlikely(__pyx_t_15 != -1)) {
18470  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18471  __PYX_ERR(0, 840, __pyx_L1_error)
18472  }
18473  __pyx_t_42 = __pyx_v_eN;
18474  __pyx_t_43 = __pyx_v_ebN;
18475  __pyx_t_44 = __pyx_v_k;
18476  __pyx_t_45 = 0;
18477  __pyx_t_15 = -1;
18478  if (__pyx_t_42 < 0) {
18479  __pyx_t_42 += __pyx_pybuffernd_v.diminfo[0].shape;
18480  if (unlikely(__pyx_t_42 < 0)) __pyx_t_15 = 0;
18481  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18482  if (__pyx_t_43 < 0) {
18483  __pyx_t_43 += __pyx_pybuffernd_v.diminfo[1].shape;
18484  if (unlikely(__pyx_t_43 < 0)) __pyx_t_15 = 1;
18485  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18486  if (__pyx_t_44 < 0) {
18487  __pyx_t_44 += __pyx_pybuffernd_v.diminfo[2].shape;
18488  if (unlikely(__pyx_t_44 < 0)) __pyx_t_15 = 2;
18489  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18490  if (__pyx_t_45 < 0) {
18491  __pyx_t_45 += __pyx_pybuffernd_v.diminfo[3].shape;
18492  if (unlikely(__pyx_t_45 < 0)) __pyx_t_15 = 3;
18493  } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18494  if (unlikely(__pyx_t_15 != -1)) {
18495  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18496  __PYX_ERR(0, 840, __pyx_L1_error)
18497  }
18498  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_44, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_45, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_40, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_41, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
18499 
18500  /* "subsurfaceTransportFunctions.pyx":841
18501  * for k in range(x.shape[2]):
18502  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18503  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
18504  * v[eN,ebN,k,2]=zvelocity
18505  * else:
18506  */
18507  __pyx_t_46 = __pyx_v_eN;
18508  __pyx_t_47 = __pyx_v_ebN;
18509  __pyx_t_48 = __pyx_v_k;
18510  __pyx_t_49 = 0;
18511  __pyx_t_15 = -1;
18512  if (__pyx_t_46 < 0) {
18513  __pyx_t_46 += __pyx_pybuffernd_x.diminfo[0].shape;
18514  if (unlikely(__pyx_t_46 < 0)) __pyx_t_15 = 0;
18515  } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18516  if (__pyx_t_47 < 0) {
18517  __pyx_t_47 += __pyx_pybuffernd_x.diminfo[1].shape;
18518  if (unlikely(__pyx_t_47 < 0)) __pyx_t_15 = 1;
18519  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18520  if (__pyx_t_48 < 0) {
18521  __pyx_t_48 += __pyx_pybuffernd_x.diminfo[2].shape;
18522  if (unlikely(__pyx_t_48 < 0)) __pyx_t_15 = 2;
18523  } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18524  if (__pyx_t_49 < 0) {
18525  __pyx_t_49 += __pyx_pybuffernd_x.diminfo[3].shape;
18526  if (unlikely(__pyx_t_49 < 0)) __pyx_t_15 = 3;
18527  } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18528  if (unlikely(__pyx_t_15 != -1)) {
18529  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18530  __PYX_ERR(0, 841, __pyx_L1_error)
18531  }
18532  __pyx_t_50 = __pyx_v_eN;
18533  __pyx_t_51 = __pyx_v_ebN;
18534  __pyx_t_52 = __pyx_v_k;
18535  __pyx_t_53 = 1;
18536  __pyx_t_15 = -1;
18537  if (__pyx_t_50 < 0) {
18538  __pyx_t_50 += __pyx_pybuffernd_v.diminfo[0].shape;
18539  if (unlikely(__pyx_t_50 < 0)) __pyx_t_15 = 0;
18540  } else if (unlikely(__pyx_t_50 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18541  if (__pyx_t_51 < 0) {
18542  __pyx_t_51 += __pyx_pybuffernd_v.diminfo[1].shape;
18543  if (unlikely(__pyx_t_51 < 0)) __pyx_t_15 = 1;
18544  } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18545  if (__pyx_t_52 < 0) {
18546  __pyx_t_52 += __pyx_pybuffernd_v.diminfo[2].shape;
18547  if (unlikely(__pyx_t_52 < 0)) __pyx_t_15 = 2;
18548  } else if (unlikely(__pyx_t_52 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18549  if (__pyx_t_53 < 0) {
18550  __pyx_t_53 += __pyx_pybuffernd_v.diminfo[3].shape;
18551  if (unlikely(__pyx_t_53 < 0)) __pyx_t_15 = 3;
18552  } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18553  if (unlikely(__pyx_t_15 != -1)) {
18554  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18555  __PYX_ERR(0, 841, __pyx_L1_error)
18556  }
18557  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_51, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_52, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_53, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_48, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_49, __pyx_pybuffernd_x.diminfo[3].strides))));
18558 
18559  /* "subsurfaceTransportFunctions.pyx":842
18560  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18561  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18562  * v[eN,ebN,k,2]=zvelocity # <<<<<<<<<<<<<<
18563  * else:
18564  * assert v.shape[v.ndim-1] == 2
18565  */
18566  __pyx_t_54 = __pyx_v_eN;
18567  __pyx_t_55 = __pyx_v_ebN;
18568  __pyx_t_56 = __pyx_v_k;
18569  __pyx_t_57 = 2;
18570  __pyx_t_15 = -1;
18571  if (__pyx_t_54 < 0) {
18572  __pyx_t_54 += __pyx_pybuffernd_v.diminfo[0].shape;
18573  if (unlikely(__pyx_t_54 < 0)) __pyx_t_15 = 0;
18574  } else if (unlikely(__pyx_t_54 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18575  if (__pyx_t_55 < 0) {
18576  __pyx_t_55 += __pyx_pybuffernd_v.diminfo[1].shape;
18577  if (unlikely(__pyx_t_55 < 0)) __pyx_t_15 = 1;
18578  } else if (unlikely(__pyx_t_55 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18579  if (__pyx_t_56 < 0) {
18580  __pyx_t_56 += __pyx_pybuffernd_v.diminfo[2].shape;
18581  if (unlikely(__pyx_t_56 < 0)) __pyx_t_15 = 2;
18582  } else if (unlikely(__pyx_t_56 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18583  if (__pyx_t_57 < 0) {
18584  __pyx_t_57 += __pyx_pybuffernd_v.diminfo[3].shape;
18585  if (unlikely(__pyx_t_57 < 0)) __pyx_t_15 = 3;
18586  } else if (unlikely(__pyx_t_57 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18587  if (unlikely(__pyx_t_15 != -1)) {
18588  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18589  __PYX_ERR(0, 842, __pyx_L1_error)
18590  }
18591  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_55, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_56, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_57, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zvelocity;
18592  }
18593  }
18594  }
18595  }
18596  __pyx_L4:;
18597 
18598  /* "subsurfaceTransportFunctions.pyx":827
18599  * cdef double pi
18600  * pi = M_PI
18601  * if v.shape[v.ndim-1] == 3: # <<<<<<<<<<<<<<
18602  * if transient == 1:
18603  * for eN in range(x.shape[0]):
18604  */
18605  goto __pyx_L3;
18606  }
18607 
18608  /* "subsurfaceTransportFunctions.pyx":844
18609  * v[eN,ebN,k,2]=zvelocity
18610  * else:
18611  * assert v.shape[v.ndim-1] == 2 # <<<<<<<<<<<<<<
18612  * if transient == 1:
18613  * for eN in range(x.shape[0]):
18614  */
18615  /*else*/ {
18616  #ifndef CYTHON_WITHOUT_ASSERTIONS
18617  if (unlikely(!Py_OptimizeFlag)) {
18618  if (unlikely(!(((__pyx_v_v->dimensions[(__pyx_v_v->nd - 1)]) == 2) != 0))) {
18619  PyErr_SetNone(PyExc_AssertionError);
18620  __PYX_ERR(0, 844, __pyx_L1_error)
18621  }
18622  }
18623  #endif
18624 
18625  /* "subsurfaceTransportFunctions.pyx":845
18626  * else:
18627  * assert v.shape[v.ndim-1] == 2
18628  * if transient == 1: # <<<<<<<<<<<<<<
18629  * for eN in range(x.shape[0]):
18630  * for ebN in range(x.shape[1]):
18631  */
18632  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
18633  if (__pyx_t_1) {
18634 
18635  /* "subsurfaceTransportFunctions.pyx":846
18636  * assert v.shape[v.ndim-1] == 2
18637  * if transient == 1:
18638  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18639  * for ebN in range(x.shape[1]):
18640  * for k in range(x.shape[2]):
18641  */
18642  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18643  __pyx_t_3 = __pyx_t_2;
18644  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18645  __pyx_v_eN = __pyx_t_4;
18646 
18647  /* "subsurfaceTransportFunctions.pyx":847
18648  * if transient == 1:
18649  * for eN in range(x.shape[0]):
18650  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
18651  * for k in range(x.shape[2]):
18652  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18653  */
18654  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
18655  __pyx_t_6 = __pyx_t_5;
18656  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
18657  __pyx_v_ebN = __pyx_t_7;
18658 
18659  /* "subsurfaceTransportFunctions.pyx":848
18660  * for eN in range(x.shape[0]):
18661  * for ebN in range(x.shape[1]):
18662  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
18663  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18664  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18665  */
18666  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
18667  __pyx_t_9 = __pyx_t_8;
18668  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
18669  __pyx_v_k = __pyx_t_10;
18670 
18671  /* "subsurfaceTransportFunctions.pyx":849
18672  * for ebN in range(x.shape[1]):
18673  * for k in range(x.shape[2]):
18674  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
18675  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18676  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18677  */
18678  __pyx_t_58 = __pyx_v_eN;
18679  __pyx_t_59 = __pyx_v_ebN;
18680  __pyx_t_60 = __pyx_v_k;
18681  __pyx_t_61 = 1;
18682  __pyx_t_15 = -1;
18683  if (__pyx_t_58 < 0) {
18684  __pyx_t_58 += __pyx_pybuffernd_x.diminfo[0].shape;
18685  if (unlikely(__pyx_t_58 < 0)) __pyx_t_15 = 0;
18686  } else if (unlikely(__pyx_t_58 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18687  if (__pyx_t_59 < 0) {
18688  __pyx_t_59 += __pyx_pybuffernd_x.diminfo[1].shape;
18689  if (unlikely(__pyx_t_59 < 0)) __pyx_t_15 = 1;
18690  } else if (unlikely(__pyx_t_59 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18691  if (__pyx_t_60 < 0) {
18692  __pyx_t_60 += __pyx_pybuffernd_x.diminfo[2].shape;
18693  if (unlikely(__pyx_t_60 < 0)) __pyx_t_15 = 2;
18694  } else if (unlikely(__pyx_t_60 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18695  if (__pyx_t_61 < 0) {
18696  __pyx_t_61 += __pyx_pybuffernd_x.diminfo[3].shape;
18697  if (unlikely(__pyx_t_61 < 0)) __pyx_t_15 = 3;
18698  } else if (unlikely(__pyx_t_61 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18699  if (unlikely(__pyx_t_15 != -1)) {
18700  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18701  __PYX_ERR(0, 849, __pyx_L1_error)
18702  }
18703  __pyx_t_62 = __pyx_v_eN;
18704  __pyx_t_63 = __pyx_v_ebN;
18705  __pyx_t_64 = __pyx_v_k;
18706  __pyx_t_65 = 0;
18707  __pyx_t_15 = -1;
18708  if (__pyx_t_62 < 0) {
18709  __pyx_t_62 += __pyx_pybuffernd_v.diminfo[0].shape;
18710  if (unlikely(__pyx_t_62 < 0)) __pyx_t_15 = 0;
18711  } else if (unlikely(__pyx_t_62 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18712  if (__pyx_t_63 < 0) {
18713  __pyx_t_63 += __pyx_pybuffernd_v.diminfo[1].shape;
18714  if (unlikely(__pyx_t_63 < 0)) __pyx_t_15 = 1;
18715  } else if (unlikely(__pyx_t_63 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18716  if (__pyx_t_64 < 0) {
18717  __pyx_t_64 += __pyx_pybuffernd_v.diminfo[2].shape;
18718  if (unlikely(__pyx_t_64 < 0)) __pyx_t_15 = 2;
18719  } else if (unlikely(__pyx_t_64 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18720  if (__pyx_t_65 < 0) {
18721  __pyx_t_65 += __pyx_pybuffernd_v.diminfo[3].shape;
18722  if (unlikely(__pyx_t_65 < 0)) __pyx_t_15 = 3;
18723  } else if (unlikely(__pyx_t_65 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18724  if (unlikely(__pyx_t_15 != -1)) {
18725  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18726  __PYX_ERR(0, 849, __pyx_L1_error)
18727  }
18728  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_62, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_63, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_64, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_65, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_59, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_60, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_61, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
18729 
18730  /* "subsurfaceTransportFunctions.pyx":850
18731  * for k in range(x.shape[2]):
18732  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18733  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
18734  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18735  * else:
18736  */
18737  __pyx_t_66 = __pyx_v_eN;
18738  __pyx_t_67 = __pyx_v_ebN;
18739  __pyx_t_68 = __pyx_v_k;
18740  __pyx_t_69 = 0;
18741  __pyx_t_15 = -1;
18742  if (__pyx_t_66 < 0) {
18743  __pyx_t_66 += __pyx_pybuffernd_x.diminfo[0].shape;
18744  if (unlikely(__pyx_t_66 < 0)) __pyx_t_15 = 0;
18745  } else if (unlikely(__pyx_t_66 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18746  if (__pyx_t_67 < 0) {
18747  __pyx_t_67 += __pyx_pybuffernd_x.diminfo[1].shape;
18748  if (unlikely(__pyx_t_67 < 0)) __pyx_t_15 = 1;
18749  } else if (unlikely(__pyx_t_67 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18750  if (__pyx_t_68 < 0) {
18751  __pyx_t_68 += __pyx_pybuffernd_x.diminfo[2].shape;
18752  if (unlikely(__pyx_t_68 < 0)) __pyx_t_15 = 2;
18753  } else if (unlikely(__pyx_t_68 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18754  if (__pyx_t_69 < 0) {
18755  __pyx_t_69 += __pyx_pybuffernd_x.diminfo[3].shape;
18756  if (unlikely(__pyx_t_69 < 0)) __pyx_t_15 = 3;
18757  } else if (unlikely(__pyx_t_69 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18758  if (unlikely(__pyx_t_15 != -1)) {
18759  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18760  __PYX_ERR(0, 850, __pyx_L1_error)
18761  }
18762  __pyx_t_70 = __pyx_v_eN;
18763  __pyx_t_71 = __pyx_v_ebN;
18764  __pyx_t_72 = __pyx_v_k;
18765  __pyx_t_73 = 1;
18766  __pyx_t_15 = -1;
18767  if (__pyx_t_70 < 0) {
18768  __pyx_t_70 += __pyx_pybuffernd_v.diminfo[0].shape;
18769  if (unlikely(__pyx_t_70 < 0)) __pyx_t_15 = 0;
18770  } else if (unlikely(__pyx_t_70 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18771  if (__pyx_t_71 < 0) {
18772  __pyx_t_71 += __pyx_pybuffernd_v.diminfo[1].shape;
18773  if (unlikely(__pyx_t_71 < 0)) __pyx_t_15 = 1;
18774  } else if (unlikely(__pyx_t_71 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18775  if (__pyx_t_72 < 0) {
18776  __pyx_t_72 += __pyx_pybuffernd_v.diminfo[2].shape;
18777  if (unlikely(__pyx_t_72 < 0)) __pyx_t_15 = 2;
18778  } else if (unlikely(__pyx_t_72 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18779  if (__pyx_t_73 < 0) {
18780  __pyx_t_73 += __pyx_pybuffernd_v.diminfo[3].shape;
18781  if (unlikely(__pyx_t_73 < 0)) __pyx_t_15 = 3;
18782  } else if (unlikely(__pyx_t_73 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18783  if (unlikely(__pyx_t_15 != -1)) {
18784  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18785  __PYX_ERR(0, 850, __pyx_L1_error)
18786  }
18787  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_70, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_71, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_72, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_73, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_66, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_67, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_68, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_69, __pyx_pybuffernd_x.diminfo[3].strides))));
18788 
18789  /* "subsurfaceTransportFunctions.pyx":851
18790  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18791  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18792  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
18793  * else:
18794  * for eN in range(x.shape[0]):
18795  */
18796  __pyx_t_35 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 851, __pyx_L1_error)
18797  __Pyx_GOTREF(__pyx_t_35);
18798  __pyx_t_32 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_32)) __PYX_ERR(0, 851, __pyx_L1_error)
18799  __Pyx_GOTREF(__pyx_t_32);
18800  __pyx_t_33 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 851, __pyx_L1_error)
18801  __Pyx_GOTREF(__pyx_t_33);
18802  __pyx_t_34 = PyTuple_New(4); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 851, __pyx_L1_error)
18803  __Pyx_GOTREF(__pyx_t_34);
18804  __Pyx_GIVEREF(__pyx_t_35);
18805  PyTuple_SET_ITEM(__pyx_t_34, 0, __pyx_t_35);
18806  __Pyx_GIVEREF(__pyx_t_32);
18807  PyTuple_SET_ITEM(__pyx_t_34, 1, __pyx_t_32);
18808  __Pyx_GIVEREF(__pyx_t_33);
18809  PyTuple_SET_ITEM(__pyx_t_34, 2, __pyx_t_33);
18810  __Pyx_INCREF(__pyx_slice_);
18811  __Pyx_GIVEREF(__pyx_slice_);
18812  PyTuple_SET_ITEM(__pyx_t_34, 3, __pyx_slice_);
18813  __pyx_t_35 = 0;
18814  __pyx_t_32 = 0;
18815  __pyx_t_33 = 0;
18816  __pyx_t_33 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_34); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 851, __pyx_L1_error)
18817  __Pyx_GOTREF(__pyx_t_33);
18818  __pyx_t_37 = (__pyx_v_tForReversal - __pyx_v_t);
18819  __pyx_t_36 = (__pyx_v_tForReversal - 0.0);
18820  if (unlikely(__pyx_t_36 == 0)) {
18821  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
18822  __PYX_ERR(0, 851, __pyx_L1_error)
18823  }
18824  __pyx_t_32 = PyFloat_FromDouble(((__pyx_t_37 / __pyx_t_36) * __pyx_v_clock)); if (unlikely(!__pyx_t_32)) __PYX_ERR(0, 851, __pyx_L1_error)
18825  __Pyx_GOTREF(__pyx_t_32);
18826  __pyx_t_35 = PyNumber_InPlaceMultiply(__pyx_t_33, __pyx_t_32); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 851, __pyx_L1_error)
18827  __Pyx_GOTREF(__pyx_t_35);
18828  __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
18829  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
18830  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_34, __pyx_t_35) < 0)) __PYX_ERR(0, 851, __pyx_L1_error)
18831  __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
18832  __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
18833  }
18834  }
18835  }
18836 
18837  /* "subsurfaceTransportFunctions.pyx":845
18838  * else:
18839  * assert v.shape[v.ndim-1] == 2
18840  * if transient == 1: # <<<<<<<<<<<<<<
18841  * for eN in range(x.shape[0]):
18842  * for ebN in range(x.shape[1]):
18843  */
18844  goto __pyx_L17;
18845  }
18846 
18847  /* "subsurfaceTransportFunctions.pyx":853
18848  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18849  * else:
18850  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18851  * for ebN in range(x.shape[1]):
18852  * for k in range(x.shape[2]):
18853  */
18854  /*else*/ {
18855  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18856  __pyx_t_3 = __pyx_t_2;
18857  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18858  __pyx_v_eN = __pyx_t_4;
18859 
18860  /* "subsurfaceTransportFunctions.pyx":854
18861  * else:
18862  * for eN in range(x.shape[0]):
18863  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
18864  * for k in range(x.shape[2]):
18865  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18866  */
18867  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
18868  __pyx_t_6 = __pyx_t_5;
18869  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
18870  __pyx_v_ebN = __pyx_t_7;
18871 
18872  /* "subsurfaceTransportFunctions.pyx":855
18873  * for eN in range(x.shape[0]):
18874  * for ebN in range(x.shape[1]):
18875  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
18876  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18877  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18878  */
18879  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
18880  __pyx_t_9 = __pyx_t_8;
18881  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
18882  __pyx_v_k = __pyx_t_10;
18883 
18884  /* "subsurfaceTransportFunctions.pyx":856
18885  * for ebN in range(x.shape[1]):
18886  * for k in range(x.shape[2]):
18887  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
18888  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18889  *
18890  */
18891  __pyx_t_74 = __pyx_v_eN;
18892  __pyx_t_75 = __pyx_v_ebN;
18893  __pyx_t_76 = __pyx_v_k;
18894  __pyx_t_77 = 1;
18895  __pyx_t_15 = -1;
18896  if (__pyx_t_74 < 0) {
18897  __pyx_t_74 += __pyx_pybuffernd_x.diminfo[0].shape;
18898  if (unlikely(__pyx_t_74 < 0)) __pyx_t_15 = 0;
18899  } else if (unlikely(__pyx_t_74 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18900  if (__pyx_t_75 < 0) {
18901  __pyx_t_75 += __pyx_pybuffernd_x.diminfo[1].shape;
18902  if (unlikely(__pyx_t_75 < 0)) __pyx_t_15 = 1;
18903  } else if (unlikely(__pyx_t_75 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18904  if (__pyx_t_76 < 0) {
18905  __pyx_t_76 += __pyx_pybuffernd_x.diminfo[2].shape;
18906  if (unlikely(__pyx_t_76 < 0)) __pyx_t_15 = 2;
18907  } else if (unlikely(__pyx_t_76 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18908  if (__pyx_t_77 < 0) {
18909  __pyx_t_77 += __pyx_pybuffernd_x.diminfo[3].shape;
18910  if (unlikely(__pyx_t_77 < 0)) __pyx_t_15 = 3;
18911  } else if (unlikely(__pyx_t_77 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18912  if (unlikely(__pyx_t_15 != -1)) {
18913  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18914  __PYX_ERR(0, 856, __pyx_L1_error)
18915  }
18916  __pyx_t_78 = __pyx_v_eN;
18917  __pyx_t_79 = __pyx_v_ebN;
18918  __pyx_t_80 = __pyx_v_k;
18919  __pyx_t_81 = 0;
18920  __pyx_t_15 = -1;
18921  if (__pyx_t_78 < 0) {
18922  __pyx_t_78 += __pyx_pybuffernd_v.diminfo[0].shape;
18923  if (unlikely(__pyx_t_78 < 0)) __pyx_t_15 = 0;
18924  } else if (unlikely(__pyx_t_78 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18925  if (__pyx_t_79 < 0) {
18926  __pyx_t_79 += __pyx_pybuffernd_v.diminfo[1].shape;
18927  if (unlikely(__pyx_t_79 < 0)) __pyx_t_15 = 1;
18928  } else if (unlikely(__pyx_t_79 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18929  if (__pyx_t_80 < 0) {
18930  __pyx_t_80 += __pyx_pybuffernd_v.diminfo[2].shape;
18931  if (unlikely(__pyx_t_80 < 0)) __pyx_t_15 = 2;
18932  } else if (unlikely(__pyx_t_80 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18933  if (__pyx_t_81 < 0) {
18934  __pyx_t_81 += __pyx_pybuffernd_v.diminfo[3].shape;
18935  if (unlikely(__pyx_t_81 < 0)) __pyx_t_15 = 3;
18936  } else if (unlikely(__pyx_t_81 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18937  if (unlikely(__pyx_t_15 != -1)) {
18938  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18939  __PYX_ERR(0, 856, __pyx_L1_error)
18940  }
18941  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_78, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_79, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_80, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_81, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_74, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_75, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_76, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_77, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
18942 
18943  /* "subsurfaceTransportFunctions.pyx":857
18944  * for k in range(x.shape[2]):
18945  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18946  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
18947  *
18948  * def helicalElementVelocityEval3(int transient,
18949  */
18950  __pyx_t_82 = __pyx_v_eN;
18951  __pyx_t_83 = __pyx_v_ebN;
18952  __pyx_t_84 = __pyx_v_k;
18953  __pyx_t_85 = 0;
18954  __pyx_t_15 = -1;
18955  if (__pyx_t_82 < 0) {
18956  __pyx_t_82 += __pyx_pybuffernd_x.diminfo[0].shape;
18957  if (unlikely(__pyx_t_82 < 0)) __pyx_t_15 = 0;
18958  } else if (unlikely(__pyx_t_82 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18959  if (__pyx_t_83 < 0) {
18960  __pyx_t_83 += __pyx_pybuffernd_x.diminfo[1].shape;
18961  if (unlikely(__pyx_t_83 < 0)) __pyx_t_15 = 1;
18962  } else if (unlikely(__pyx_t_83 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18963  if (__pyx_t_84 < 0) {
18964  __pyx_t_84 += __pyx_pybuffernd_x.diminfo[2].shape;
18965  if (unlikely(__pyx_t_84 < 0)) __pyx_t_15 = 2;
18966  } else if (unlikely(__pyx_t_84 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18967  if (__pyx_t_85 < 0) {
18968  __pyx_t_85 += __pyx_pybuffernd_x.diminfo[3].shape;
18969  if (unlikely(__pyx_t_85 < 0)) __pyx_t_15 = 3;
18970  } else if (unlikely(__pyx_t_85 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18971  if (unlikely(__pyx_t_15 != -1)) {
18972  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18973  __PYX_ERR(0, 857, __pyx_L1_error)
18974  }
18975  __pyx_t_86 = __pyx_v_eN;
18976  __pyx_t_87 = __pyx_v_ebN;
18977  __pyx_t_88 = __pyx_v_k;
18978  __pyx_t_89 = 1;
18979  __pyx_t_15 = -1;
18980  if (__pyx_t_86 < 0) {
18981  __pyx_t_86 += __pyx_pybuffernd_v.diminfo[0].shape;
18982  if (unlikely(__pyx_t_86 < 0)) __pyx_t_15 = 0;
18983  } else if (unlikely(__pyx_t_86 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18984  if (__pyx_t_87 < 0) {
18985  __pyx_t_87 += __pyx_pybuffernd_v.diminfo[1].shape;
18986  if (unlikely(__pyx_t_87 < 0)) __pyx_t_15 = 1;
18987  } else if (unlikely(__pyx_t_87 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18988  if (__pyx_t_88 < 0) {
18989  __pyx_t_88 += __pyx_pybuffernd_v.diminfo[2].shape;
18990  if (unlikely(__pyx_t_88 < 0)) __pyx_t_15 = 2;
18991  } else if (unlikely(__pyx_t_88 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18992  if (__pyx_t_89 < 0) {
18993  __pyx_t_89 += __pyx_pybuffernd_v.diminfo[3].shape;
18994  if (unlikely(__pyx_t_89 < 0)) __pyx_t_15 = 3;
18995  } else if (unlikely(__pyx_t_89 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18996  if (unlikely(__pyx_t_15 != -1)) {
18997  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18998  __PYX_ERR(0, 857, __pyx_L1_error)
18999  }
19000  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_86, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_87, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_88, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_89, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_82, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_83, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_84, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_85, __pyx_pybuffernd_x.diminfo[3].strides))));
19001  }
19002  }
19003  }
19004  }
19005  __pyx_L17:;
19006  }
19007  __pyx_L3:;
19008 
19009  /* "subsurfaceTransportFunctions.pyx":816
19010  *
19011  *
19012  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
19013  * double t,
19014  * double tForReversal,
19015  */
19016 
19017  /* function exit code */
19018  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19019  goto __pyx_L0;
19020  __pyx_L1_error:;
19021  __Pyx_XDECREF(__pyx_t_32);
19022  __Pyx_XDECREF(__pyx_t_33);
19023  __Pyx_XDECREF(__pyx_t_34);
19024  __Pyx_XDECREF(__pyx_t_35);
19025  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
19026  __Pyx_PyThreadState_declare
19027  __Pyx_PyThreadState_assign
19028  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
19029  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
19030  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
19031  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
19032  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
19033  __pyx_r = NULL;
19034  goto __pyx_L2;
19035  __pyx_L0:;
19036  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
19037  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
19038  __pyx_L2:;
19039  __Pyx_XGIVEREF(__pyx_r);
19040  __Pyx_RefNannyFinishContext();
19041  return __pyx_r;
19042 }
19043 
19044 /* "subsurfaceTransportFunctions.pyx":859
19045  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19046  *
19047  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
19048  * double t,
19049  * double tForReversal,
19050  */
19051 
19052 /* Python wrapper */
19053 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_51helicalElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
19054 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_51helicalElementVelocityEval3 = {"helicalElementVelocityEval3", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_51helicalElementVelocityEval3, METH_VARARGS|METH_KEYWORDS, 0};
19055 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_51helicalElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
19056  int __pyx_v_transient;
19057  double __pyx_v_t;
19058  double __pyx_v_tForReversal;
19059  double __pyx_v_clock;
19060  double __pyx_v_zVelocity;
19061  double __pyx_v_xc;
19062  double __pyx_v_yc;
19063  PyArrayObject *__pyx_v_x = 0;
19064  PyArrayObject *__pyx_v_v = 0;
19065  PyObject *__pyx_r = 0;
19066  __Pyx_RefNannyDeclarations
19067  __Pyx_RefNannySetupContext("helicalElementVelocityEval3 (wrapper)", 0);
19068  {
19069  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_zVelocity,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,0};
19070  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
19071  if (unlikely(__pyx_kwds)) {
19072  Py_ssize_t kw_args;
19073  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
19074  switch (pos_args) {
19075  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
19076  CYTHON_FALLTHROUGH;
19077  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
19078  CYTHON_FALLTHROUGH;
19079  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
19080  CYTHON_FALLTHROUGH;
19081  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
19082  CYTHON_FALLTHROUGH;
19083  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
19084  CYTHON_FALLTHROUGH;
19085  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19086  CYTHON_FALLTHROUGH;
19087  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19088  CYTHON_FALLTHROUGH;
19089  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19090  CYTHON_FALLTHROUGH;
19091  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19092  CYTHON_FALLTHROUGH;
19093  case 0: break;
19094  default: goto __pyx_L5_argtuple_error;
19095  }
19096  kw_args = PyDict_Size(__pyx_kwds);
19097  switch (pos_args) {
19098  case 0:
19099  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
19100  else goto __pyx_L5_argtuple_error;
19101  CYTHON_FALLTHROUGH;
19102  case 1:
19103  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
19104  else {
19105  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 1); __PYX_ERR(0, 859, __pyx_L3_error)
19106  }
19107  CYTHON_FALLTHROUGH;
19108  case 2:
19109  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
19110  else {
19111  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 2); __PYX_ERR(0, 859, __pyx_L3_error)
19112  }
19113  CYTHON_FALLTHROUGH;
19114  case 3:
19115  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
19116  else {
19117  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 3); __PYX_ERR(0, 859, __pyx_L3_error)
19118  }
19119  CYTHON_FALLTHROUGH;
19120  case 4:
19121  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zVelocity)) != 0)) kw_args--;
19122  else {
19123  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 4); __PYX_ERR(0, 859, __pyx_L3_error)
19124  }
19125  CYTHON_FALLTHROUGH;
19126  case 5:
19127  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
19128  else {
19129  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 5); __PYX_ERR(0, 859, __pyx_L3_error)
19130  }
19131  CYTHON_FALLTHROUGH;
19132  case 6:
19133  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
19134  else {
19135  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 6); __PYX_ERR(0, 859, __pyx_L3_error)
19136  }
19137  CYTHON_FALLTHROUGH;
19138  case 7:
19139  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
19140  else {
19141  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 7); __PYX_ERR(0, 859, __pyx_L3_error)
19142  }
19143  CYTHON_FALLTHROUGH;
19144  case 8:
19145  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
19146  else {
19147  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 8); __PYX_ERR(0, 859, __pyx_L3_error)
19148  }
19149  }
19150  if (unlikely(kw_args > 0)) {
19151  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "helicalElementVelocityEval3") < 0)) __PYX_ERR(0, 859, __pyx_L3_error)
19152  }
19153  } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
19154  goto __pyx_L5_argtuple_error;
19155  } else {
19156  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19157  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19158  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19159  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19160  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
19161  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
19162  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
19163  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
19164  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
19165  }
19166  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 859, __pyx_L3_error)
19167  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 860, __pyx_L3_error)
19168  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 861, __pyx_L3_error)
19169  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 862, __pyx_L3_error)
19170  __pyx_v_zVelocity = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_zVelocity == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 863, __pyx_L3_error)
19171  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 864, __pyx_L3_error)
19172  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 864, __pyx_L3_error)
19173  __pyx_v_x = ((PyArrayObject *)values[7]);
19174  __pyx_v_v = ((PyArrayObject *)values[8]);
19175  }
19176  goto __pyx_L4_argument_unpacking_done;
19177  __pyx_L5_argtuple_error:;
19178  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 859, __pyx_L3_error)
19179  __pyx_L3_error:;
19180  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
19181  __Pyx_RefNannyFinishContext();
19182  return NULL;
19183  __pyx_L4_argument_unpacking_done:;
19184  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 865, __pyx_L1_error)
19185  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 866, __pyx_L1_error)
19186  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_50helicalElementVelocityEval3(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_zVelocity, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v);
19187 
19188  /* function exit code */
19189  goto __pyx_L0;
19190  __pyx_L1_error:;
19191  __pyx_r = NULL;
19192  __pyx_L0:;
19193  __Pyx_RefNannyFinishContext();
19194  return __pyx_r;
19195 }
19196 
19197 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_50helicalElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
19198  int __pyx_v_eN;
19199  int __pyx_v_k;
19200  double __pyx_v_pi;
19201  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
19202  __Pyx_Buffer __pyx_pybuffer_v;
19203  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
19204  __Pyx_Buffer __pyx_pybuffer_x;
19205  PyObject *__pyx_r = NULL;
19206  __Pyx_RefNannyDeclarations
19207  int __pyx_t_1;
19208  npy_intp __pyx_t_2;
19209  npy_intp __pyx_t_3;
19210  int __pyx_t_4;
19211  npy_intp __pyx_t_5;
19212  npy_intp __pyx_t_6;
19213  int __pyx_t_7;
19214  Py_ssize_t __pyx_t_8;
19215  Py_ssize_t __pyx_t_9;
19216  Py_ssize_t __pyx_t_10;
19217  int __pyx_t_11;
19218  Py_ssize_t __pyx_t_12;
19219  Py_ssize_t __pyx_t_13;
19220  Py_ssize_t __pyx_t_14;
19221  Py_ssize_t __pyx_t_15;
19222  Py_ssize_t __pyx_t_16;
19223  Py_ssize_t __pyx_t_17;
19224  Py_ssize_t __pyx_t_18;
19225  Py_ssize_t __pyx_t_19;
19226  Py_ssize_t __pyx_t_20;
19227  Py_ssize_t __pyx_t_21;
19228  Py_ssize_t __pyx_t_22;
19229  Py_ssize_t __pyx_t_23;
19230  PyObject *__pyx_t_24 = NULL;
19231  PyObject *__pyx_t_25 = NULL;
19232  PyObject *__pyx_t_26 = NULL;
19233  double __pyx_t_27;
19234  double __pyx_t_28;
19235  PyObject *__pyx_t_29 = NULL;
19236  Py_ssize_t __pyx_t_30;
19237  Py_ssize_t __pyx_t_31;
19238  Py_ssize_t __pyx_t_32;
19239  Py_ssize_t __pyx_t_33;
19240  Py_ssize_t __pyx_t_34;
19241  Py_ssize_t __pyx_t_35;
19242  Py_ssize_t __pyx_t_36;
19243  Py_ssize_t __pyx_t_37;
19244  Py_ssize_t __pyx_t_38;
19245  Py_ssize_t __pyx_t_39;
19246  Py_ssize_t __pyx_t_40;
19247  Py_ssize_t __pyx_t_41;
19248  Py_ssize_t __pyx_t_42;
19249  Py_ssize_t __pyx_t_43;
19250  Py_ssize_t __pyx_t_44;
19251  __Pyx_RefNannySetupContext("helicalElementVelocityEval3", 0);
19252  __pyx_pybuffer_x.pybuffer.buf = NULL;
19253  __pyx_pybuffer_x.refcount = 0;
19254  __pyx_pybuffernd_x.data = NULL;
19255  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
19256  __pyx_pybuffer_v.pybuffer.buf = NULL;
19257  __pyx_pybuffer_v.refcount = 0;
19258  __pyx_pybuffernd_v.data = NULL;
19259  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
19260  {
19261  __Pyx_BufFmt_StackElem __pyx_stack[1];
19262  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 859, __pyx_L1_error)
19263  }
19264  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
19265  {
19266  __Pyx_BufFmt_StackElem __pyx_stack[1];
19267  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 859, __pyx_L1_error)
19268  }
19269  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
19270 
19271  /* "subsurfaceTransportFunctions.pyx":869
19272  * cdef int eN,k
19273  * cdef double pi
19274  * pi = M_PI # <<<<<<<<<<<<<<
19275  * if transient == 1:
19276  * for eN in range(x.shape[0]):
19277  */
19278  __pyx_v_pi = M_PI;
19279 
19280  /* "subsurfaceTransportFunctions.pyx":870
19281  * cdef double pi
19282  * pi = M_PI
19283  * if transient == 1: # <<<<<<<<<<<<<<
19284  * for eN in range(x.shape[0]):
19285  * for k in range(x.shape[1]):
19286  */
19287  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
19288  if (__pyx_t_1) {
19289 
19290  /* "subsurfaceTransportFunctions.pyx":871
19291  * pi = M_PI
19292  * if transient == 1:
19293  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
19294  * for k in range(x.shape[1]):
19295  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19296  */
19297  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
19298  __pyx_t_3 = __pyx_t_2;
19299  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19300  __pyx_v_eN = __pyx_t_4;
19301 
19302  /* "subsurfaceTransportFunctions.pyx":872
19303  * if transient == 1:
19304  * for eN in range(x.shape[0]):
19305  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
19306  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19307  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19308  */
19309  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
19310  __pyx_t_6 = __pyx_t_5;
19311  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
19312  __pyx_v_k = __pyx_t_7;
19313 
19314  /* "subsurfaceTransportFunctions.pyx":873
19315  * for eN in range(x.shape[0]):
19316  * for k in range(x.shape[1]):
19317  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
19318  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19319  * v[eN,k,2]=zVelocity
19320  */
19321  __pyx_t_8 = __pyx_v_eN;
19322  __pyx_t_9 = __pyx_v_k;
19323  __pyx_t_10 = 1;
19324  __pyx_t_11 = -1;
19325  if (__pyx_t_8 < 0) {
19326  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
19327  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
19328  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19329  if (__pyx_t_9 < 0) {
19330  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
19331  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
19332  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19333  if (__pyx_t_10 < 0) {
19334  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
19335  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
19336  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19337  if (unlikely(__pyx_t_11 != -1)) {
19338  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19339  __PYX_ERR(0, 873, __pyx_L1_error)
19340  }
19341  __pyx_t_12 = __pyx_v_eN;
19342  __pyx_t_13 = __pyx_v_k;
19343  __pyx_t_14 = 0;
19344  __pyx_t_11 = -1;
19345  if (__pyx_t_12 < 0) {
19346  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[0].shape;
19347  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
19348  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19349  if (__pyx_t_13 < 0) {
19350  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
19351  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
19352  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19353  if (__pyx_t_14 < 0) {
19354  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[2].shape;
19355  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 2;
19356  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19357  if (unlikely(__pyx_t_11 != -1)) {
19358  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19359  __PYX_ERR(0, 873, __pyx_L1_error)
19360  }
19361  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
19362 
19363  /* "subsurfaceTransportFunctions.pyx":874
19364  * for k in range(x.shape[1]):
19365  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19366  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
19367  * v[eN,k,2]=zVelocity
19368  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19369  */
19370  __pyx_t_15 = __pyx_v_eN;
19371  __pyx_t_16 = __pyx_v_k;
19372  __pyx_t_17 = 0;
19373  __pyx_t_11 = -1;
19374  if (__pyx_t_15 < 0) {
19375  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[0].shape;
19376  if (unlikely(__pyx_t_15 < 0)) __pyx_t_11 = 0;
19377  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19378  if (__pyx_t_16 < 0) {
19379  __pyx_t_16 += __pyx_pybuffernd_x.diminfo[1].shape;
19380  if (unlikely(__pyx_t_16 < 0)) __pyx_t_11 = 1;
19381  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19382  if (__pyx_t_17 < 0) {
19383  __pyx_t_17 += __pyx_pybuffernd_x.diminfo[2].shape;
19384  if (unlikely(__pyx_t_17 < 0)) __pyx_t_11 = 2;
19385  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19386  if (unlikely(__pyx_t_11 != -1)) {
19387  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19388  __PYX_ERR(0, 874, __pyx_L1_error)
19389  }
19390  __pyx_t_18 = __pyx_v_eN;
19391  __pyx_t_19 = __pyx_v_k;
19392  __pyx_t_20 = 1;
19393  __pyx_t_11 = -1;
19394  if (__pyx_t_18 < 0) {
19395  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[0].shape;
19396  if (unlikely(__pyx_t_18 < 0)) __pyx_t_11 = 0;
19397  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19398  if (__pyx_t_19 < 0) {
19399  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[1].shape;
19400  if (unlikely(__pyx_t_19 < 0)) __pyx_t_11 = 1;
19401  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19402  if (__pyx_t_20 < 0) {
19403  __pyx_t_20 += __pyx_pybuffernd_v.diminfo[2].shape;
19404  if (unlikely(__pyx_t_20 < 0)) __pyx_t_11 = 2;
19405  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19406  if (unlikely(__pyx_t_11 != -1)) {
19407  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19408  __PYX_ERR(0, 874, __pyx_L1_error)
19409  }
19410  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_x.diminfo[2].strides))));
19411 
19412  /* "subsurfaceTransportFunctions.pyx":875
19413  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19414  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19415  * v[eN,k,2]=zVelocity # <<<<<<<<<<<<<<
19416  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19417  * else:
19418  */
19419  __pyx_t_21 = __pyx_v_eN;
19420  __pyx_t_22 = __pyx_v_k;
19421  __pyx_t_23 = 2;
19422  __pyx_t_11 = -1;
19423  if (__pyx_t_21 < 0) {
19424  __pyx_t_21 += __pyx_pybuffernd_v.diminfo[0].shape;
19425  if (unlikely(__pyx_t_21 < 0)) __pyx_t_11 = 0;
19426  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19427  if (__pyx_t_22 < 0) {
19428  __pyx_t_22 += __pyx_pybuffernd_v.diminfo[1].shape;
19429  if (unlikely(__pyx_t_22 < 0)) __pyx_t_11 = 1;
19430  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19431  if (__pyx_t_23 < 0) {
19432  __pyx_t_23 += __pyx_pybuffernd_v.diminfo[2].shape;
19433  if (unlikely(__pyx_t_23 < 0)) __pyx_t_11 = 2;
19434  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19435  if (unlikely(__pyx_t_11 != -1)) {
19436  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19437  __PYX_ERR(0, 875, __pyx_L1_error)
19438  }
19439  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_23, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zVelocity;
19440 
19441  /* "subsurfaceTransportFunctions.pyx":876
19442  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19443  * v[eN,k,2]=zVelocity
19444  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0)) # <<<<<<<<<<<<<<
19445  * else:
19446  * for eN in range(x.shape[0]):
19447  */
19448  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 876, __pyx_L1_error)
19449  __Pyx_GOTREF(__pyx_t_24);
19450  __pyx_t_25 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 876, __pyx_L1_error)
19451  __Pyx_GOTREF(__pyx_t_25);
19452  __pyx_t_26 = PyTuple_New(3); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 876, __pyx_L1_error)
19453  __Pyx_GOTREF(__pyx_t_26);
19454  __Pyx_GIVEREF(__pyx_t_24);
19455  PyTuple_SET_ITEM(__pyx_t_26, 0, __pyx_t_24);
19456  __Pyx_GIVEREF(__pyx_t_25);
19457  PyTuple_SET_ITEM(__pyx_t_26, 1, __pyx_t_25);
19458  __Pyx_INCREF(__pyx_slice_);
19459  __Pyx_GIVEREF(__pyx_slice_);
19460  PyTuple_SET_ITEM(__pyx_t_26, 2, __pyx_slice_);
19461  __pyx_t_24 = 0;
19462  __pyx_t_25 = 0;
19463  __pyx_t_25 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_26); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 876, __pyx_L1_error)
19464  __Pyx_GOTREF(__pyx_t_25);
19465  __pyx_t_27 = (__pyx_v_pi * __pyx_v_t);
19466  __pyx_t_28 = (__pyx_v_tForReversal * 2.0);
19467  if (unlikely(__pyx_t_28 == 0)) {
19468  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
19469  __PYX_ERR(0, 876, __pyx_L1_error)
19470  }
19471  __pyx_t_24 = PyFloat_FromDouble((__pyx_v_clock * cos((__pyx_t_27 / __pyx_t_28)))); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 876, __pyx_L1_error)
19472  __Pyx_GOTREF(__pyx_t_24);
19473  __pyx_t_29 = PyNumber_InPlaceMultiply(__pyx_t_25, __pyx_t_24); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 876, __pyx_L1_error)
19474  __Pyx_GOTREF(__pyx_t_29);
19475  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
19476  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
19477  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_26, __pyx_t_29) < 0)) __PYX_ERR(0, 876, __pyx_L1_error)
19478  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
19479  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
19480  }
19481  }
19482 
19483  /* "subsurfaceTransportFunctions.pyx":870
19484  * cdef double pi
19485  * pi = M_PI
19486  * if transient == 1: # <<<<<<<<<<<<<<
19487  * for eN in range(x.shape[0]):
19488  * for k in range(x.shape[1]):
19489  */
19490  goto __pyx_L3;
19491  }
19492 
19493  /* "subsurfaceTransportFunctions.pyx":878
19494  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19495  * else:
19496  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
19497  * for k in range(x.shape[1]):
19498  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19499  */
19500  /*else*/ {
19501  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
19502  __pyx_t_3 = __pyx_t_2;
19503  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19504  __pyx_v_eN = __pyx_t_4;
19505 
19506  /* "subsurfaceTransportFunctions.pyx":879
19507  * else:
19508  * for eN in range(x.shape[0]):
19509  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
19510  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19511  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19512  */
19513  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
19514  __pyx_t_6 = __pyx_t_5;
19515  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
19516  __pyx_v_k = __pyx_t_7;
19517 
19518  /* "subsurfaceTransportFunctions.pyx":880
19519  * for eN in range(x.shape[0]):
19520  * for k in range(x.shape[1]):
19521  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
19522  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19523  * v[eN,k,2]=zVelocity
19524  */
19525  __pyx_t_30 = __pyx_v_eN;
19526  __pyx_t_31 = __pyx_v_k;
19527  __pyx_t_32 = 1;
19528  __pyx_t_11 = -1;
19529  if (__pyx_t_30 < 0) {
19530  __pyx_t_30 += __pyx_pybuffernd_x.diminfo[0].shape;
19531  if (unlikely(__pyx_t_30 < 0)) __pyx_t_11 = 0;
19532  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19533  if (__pyx_t_31 < 0) {
19534  __pyx_t_31 += __pyx_pybuffernd_x.diminfo[1].shape;
19535  if (unlikely(__pyx_t_31 < 0)) __pyx_t_11 = 1;
19536  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19537  if (__pyx_t_32 < 0) {
19538  __pyx_t_32 += __pyx_pybuffernd_x.diminfo[2].shape;
19539  if (unlikely(__pyx_t_32 < 0)) __pyx_t_11 = 2;
19540  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19541  if (unlikely(__pyx_t_11 != -1)) {
19542  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19543  __PYX_ERR(0, 880, __pyx_L1_error)
19544  }
19545  __pyx_t_33 = __pyx_v_eN;
19546  __pyx_t_34 = __pyx_v_k;
19547  __pyx_t_35 = 0;
19548  __pyx_t_11 = -1;
19549  if (__pyx_t_33 < 0) {
19550  __pyx_t_33 += __pyx_pybuffernd_v.diminfo[0].shape;
19551  if (unlikely(__pyx_t_33 < 0)) __pyx_t_11 = 0;
19552  } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19553  if (__pyx_t_34 < 0) {
19554  __pyx_t_34 += __pyx_pybuffernd_v.diminfo[1].shape;
19555  if (unlikely(__pyx_t_34 < 0)) __pyx_t_11 = 1;
19556  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19557  if (__pyx_t_35 < 0) {
19558  __pyx_t_35 += __pyx_pybuffernd_v.diminfo[2].shape;
19559  if (unlikely(__pyx_t_35 < 0)) __pyx_t_11 = 2;
19560  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19561  if (unlikely(__pyx_t_11 != -1)) {
19562  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19563  __PYX_ERR(0, 880, __pyx_L1_error)
19564  }
19565  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_35, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_32, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
19566 
19567  /* "subsurfaceTransportFunctions.pyx":881
19568  * for k in range(x.shape[1]):
19569  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19570  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
19571  * v[eN,k,2]=zVelocity
19572  *
19573  */
19574  __pyx_t_36 = __pyx_v_eN;
19575  __pyx_t_37 = __pyx_v_k;
19576  __pyx_t_38 = 0;
19577  __pyx_t_11 = -1;
19578  if (__pyx_t_36 < 0) {
19579  __pyx_t_36 += __pyx_pybuffernd_x.diminfo[0].shape;
19580  if (unlikely(__pyx_t_36 < 0)) __pyx_t_11 = 0;
19581  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19582  if (__pyx_t_37 < 0) {
19583  __pyx_t_37 += __pyx_pybuffernd_x.diminfo[1].shape;
19584  if (unlikely(__pyx_t_37 < 0)) __pyx_t_11 = 1;
19585  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19586  if (__pyx_t_38 < 0) {
19587  __pyx_t_38 += __pyx_pybuffernd_x.diminfo[2].shape;
19588  if (unlikely(__pyx_t_38 < 0)) __pyx_t_11 = 2;
19589  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19590  if (unlikely(__pyx_t_11 != -1)) {
19591  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19592  __PYX_ERR(0, 881, __pyx_L1_error)
19593  }
19594  __pyx_t_39 = __pyx_v_eN;
19595  __pyx_t_40 = __pyx_v_k;
19596  __pyx_t_41 = 1;
19597  __pyx_t_11 = -1;
19598  if (__pyx_t_39 < 0) {
19599  __pyx_t_39 += __pyx_pybuffernd_v.diminfo[0].shape;
19600  if (unlikely(__pyx_t_39 < 0)) __pyx_t_11 = 0;
19601  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19602  if (__pyx_t_40 < 0) {
19603  __pyx_t_40 += __pyx_pybuffernd_v.diminfo[1].shape;
19604  if (unlikely(__pyx_t_40 < 0)) __pyx_t_11 = 1;
19605  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19606  if (__pyx_t_41 < 0) {
19607  __pyx_t_41 += __pyx_pybuffernd_v.diminfo[2].shape;
19608  if (unlikely(__pyx_t_41 < 0)) __pyx_t_11 = 2;
19609  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19610  if (unlikely(__pyx_t_11 != -1)) {
19611  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19612  __PYX_ERR(0, 881, __pyx_L1_error)
19613  }
19614  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_41, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_38, __pyx_pybuffernd_x.diminfo[2].strides))));
19615 
19616  /* "subsurfaceTransportFunctions.pyx":882
19617  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19618  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19619  * v[eN,k,2]=zVelocity # <<<<<<<<<<<<<<
19620  *
19621  * def helicalElementVelocityEval4(int transient,
19622  */
19623  __pyx_t_42 = __pyx_v_eN;
19624  __pyx_t_43 = __pyx_v_k;
19625  __pyx_t_44 = 2;
19626  __pyx_t_11 = -1;
19627  if (__pyx_t_42 < 0) {
19628  __pyx_t_42 += __pyx_pybuffernd_v.diminfo[0].shape;
19629  if (unlikely(__pyx_t_42 < 0)) __pyx_t_11 = 0;
19630  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19631  if (__pyx_t_43 < 0) {
19632  __pyx_t_43 += __pyx_pybuffernd_v.diminfo[1].shape;
19633  if (unlikely(__pyx_t_43 < 0)) __pyx_t_11 = 1;
19634  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19635  if (__pyx_t_44 < 0) {
19636  __pyx_t_44 += __pyx_pybuffernd_v.diminfo[2].shape;
19637  if (unlikely(__pyx_t_44 < 0)) __pyx_t_11 = 2;
19638  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19639  if (unlikely(__pyx_t_11 != -1)) {
19640  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19641  __PYX_ERR(0, 882, __pyx_L1_error)
19642  }
19643  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_44, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zVelocity;
19644  }
19645  }
19646  }
19647  __pyx_L3:;
19648 
19649  /* "subsurfaceTransportFunctions.pyx":859
19650  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19651  *
19652  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
19653  * double t,
19654  * double tForReversal,
19655  */
19656 
19657  /* function exit code */
19658  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19659  goto __pyx_L0;
19660  __pyx_L1_error:;
19661  __Pyx_XDECREF(__pyx_t_24);
19662  __Pyx_XDECREF(__pyx_t_25);
19663  __Pyx_XDECREF(__pyx_t_26);
19664  __Pyx_XDECREF(__pyx_t_29);
19665  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
19666  __Pyx_PyThreadState_declare
19667  __Pyx_PyThreadState_assign
19668  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
19669  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
19670  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
19671  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
19672  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
19673  __pyx_r = NULL;
19674  goto __pyx_L2;
19675  __pyx_L0:;
19676  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
19677  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
19678  __pyx_L2:;
19679  __Pyx_XGIVEREF(__pyx_r);
19680  __Pyx_RefNannyFinishContext();
19681  return __pyx_r;
19682 }
19683 
19684 /* "subsurfaceTransportFunctions.pyx":884
19685  * v[eN,k,2]=zVelocity
19686  *
19687  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
19688  * double t,
19689  * double tForReversal,
19690  */
19691 
19692 /* Python wrapper */
19693 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_53helicalElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
19694 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_53helicalElementVelocityEval4 = {"helicalElementVelocityEval4", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_53helicalElementVelocityEval4, METH_VARARGS|METH_KEYWORDS, 0};
19695 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_53helicalElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
19696  int __pyx_v_transient;
19697  double __pyx_v_t;
19698  double __pyx_v_tForReversal;
19699  double __pyx_v_clock;
19700  double __pyx_v_zVelocity;
19701  double __pyx_v_xc;
19702  double __pyx_v_yc;
19703  PyArrayObject *__pyx_v_x = 0;
19704  PyArrayObject *__pyx_v_v = 0;
19705  PyObject *__pyx_r = 0;
19706  __Pyx_RefNannyDeclarations
19707  __Pyx_RefNannySetupContext("helicalElementVelocityEval4 (wrapper)", 0);
19708  {
19709  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_zVelocity,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,0};
19710  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
19711  if (unlikely(__pyx_kwds)) {
19712  Py_ssize_t kw_args;
19713  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
19714  switch (pos_args) {
19715  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
19716  CYTHON_FALLTHROUGH;
19717  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
19718  CYTHON_FALLTHROUGH;
19719  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
19720  CYTHON_FALLTHROUGH;
19721  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
19722  CYTHON_FALLTHROUGH;
19723  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
19724  CYTHON_FALLTHROUGH;
19725  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19726  CYTHON_FALLTHROUGH;
19727  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19728  CYTHON_FALLTHROUGH;
19729  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19730  CYTHON_FALLTHROUGH;
19731  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19732  CYTHON_FALLTHROUGH;
19733  case 0: break;
19734  default: goto __pyx_L5_argtuple_error;
19735  }
19736  kw_args = PyDict_Size(__pyx_kwds);
19737  switch (pos_args) {
19738  case 0:
19739  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
19740  else goto __pyx_L5_argtuple_error;
19741  CYTHON_FALLTHROUGH;
19742  case 1:
19743  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
19744  else {
19745  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 1); __PYX_ERR(0, 884, __pyx_L3_error)
19746  }
19747  CYTHON_FALLTHROUGH;
19748  case 2:
19749  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
19750  else {
19751  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 2); __PYX_ERR(0, 884, __pyx_L3_error)
19752  }
19753  CYTHON_FALLTHROUGH;
19754  case 3:
19755  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
19756  else {
19757  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 3); __PYX_ERR(0, 884, __pyx_L3_error)
19758  }
19759  CYTHON_FALLTHROUGH;
19760  case 4:
19761  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zVelocity)) != 0)) kw_args--;
19762  else {
19763  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 4); __PYX_ERR(0, 884, __pyx_L3_error)
19764  }
19765  CYTHON_FALLTHROUGH;
19766  case 5:
19767  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
19768  else {
19769  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 5); __PYX_ERR(0, 884, __pyx_L3_error)
19770  }
19771  CYTHON_FALLTHROUGH;
19772  case 6:
19773  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
19774  else {
19775  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 6); __PYX_ERR(0, 884, __pyx_L3_error)
19776  }
19777  CYTHON_FALLTHROUGH;
19778  case 7:
19779  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
19780  else {
19781  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 7); __PYX_ERR(0, 884, __pyx_L3_error)
19782  }
19783  CYTHON_FALLTHROUGH;
19784  case 8:
19785  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
19786  else {
19787  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 8); __PYX_ERR(0, 884, __pyx_L3_error)
19788  }
19789  }
19790  if (unlikely(kw_args > 0)) {
19791  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "helicalElementVelocityEval4") < 0)) __PYX_ERR(0, 884, __pyx_L3_error)
19792  }
19793  } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
19794  goto __pyx_L5_argtuple_error;
19795  } else {
19796  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19797  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19798  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19799  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19800  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
19801  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
19802  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
19803  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
19804  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
19805  }
19806  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 884, __pyx_L3_error)
19807  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 885, __pyx_L3_error)
19808  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 886, __pyx_L3_error)
19809  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 887, __pyx_L3_error)
19810  __pyx_v_zVelocity = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_zVelocity == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 888, __pyx_L3_error)
19811  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 889, __pyx_L3_error)
19812  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 889, __pyx_L3_error)
19813  __pyx_v_x = ((PyArrayObject *)values[7]);
19814  __pyx_v_v = ((PyArrayObject *)values[8]);
19815  }
19816  goto __pyx_L4_argument_unpacking_done;
19817  __pyx_L5_argtuple_error:;
19818  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 884, __pyx_L3_error)
19819  __pyx_L3_error:;
19820  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
19821  __Pyx_RefNannyFinishContext();
19822  return NULL;
19823  __pyx_L4_argument_unpacking_done:;
19824  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 890, __pyx_L1_error)
19825  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 891, __pyx_L1_error)
19826  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_52helicalElementVelocityEval4(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_zVelocity, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v);
19827 
19828  /* function exit code */
19829  goto __pyx_L0;
19830  __pyx_L1_error:;
19831  __pyx_r = NULL;
19832  __pyx_L0:;
19833  __Pyx_RefNannyFinishContext();
19834  return __pyx_r;
19835 }
19836 
19837 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_52helicalElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
19838  int __pyx_v_eN;
19839  int __pyx_v_ebN;
19840  int __pyx_v_k;
19841  double __pyx_v_pi;
19842  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
19843  __Pyx_Buffer __pyx_pybuffer_v;
19844  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
19845  __Pyx_Buffer __pyx_pybuffer_x;
19846  PyObject *__pyx_r = NULL;
19847  __Pyx_RefNannyDeclarations
19848  int __pyx_t_1;
19849  npy_intp __pyx_t_2;
19850  npy_intp __pyx_t_3;
19851  int __pyx_t_4;
19852  npy_intp __pyx_t_5;
19853  npy_intp __pyx_t_6;
19854  int __pyx_t_7;
19855  npy_intp __pyx_t_8;
19856  npy_intp __pyx_t_9;
19857  int __pyx_t_10;
19858  Py_ssize_t __pyx_t_11;
19859  Py_ssize_t __pyx_t_12;
19860  Py_ssize_t __pyx_t_13;
19861  Py_ssize_t __pyx_t_14;
19862  int __pyx_t_15;
19863  Py_ssize_t __pyx_t_16;
19864  Py_ssize_t __pyx_t_17;
19865  Py_ssize_t __pyx_t_18;
19866  Py_ssize_t __pyx_t_19;
19867  Py_ssize_t __pyx_t_20;
19868  Py_ssize_t __pyx_t_21;
19869  Py_ssize_t __pyx_t_22;
19870  Py_ssize_t __pyx_t_23;
19871  Py_ssize_t __pyx_t_24;
19872  Py_ssize_t __pyx_t_25;
19873  Py_ssize_t __pyx_t_26;
19874  Py_ssize_t __pyx_t_27;
19875  Py_ssize_t __pyx_t_28;
19876  Py_ssize_t __pyx_t_29;
19877  Py_ssize_t __pyx_t_30;
19878  Py_ssize_t __pyx_t_31;
19879  PyObject *__pyx_t_32 = NULL;
19880  PyObject *__pyx_t_33 = NULL;
19881  PyObject *__pyx_t_34 = NULL;
19882  PyObject *__pyx_t_35 = NULL;
19883  double __pyx_t_36;
19884  double __pyx_t_37;
19885  Py_ssize_t __pyx_t_38;
19886  Py_ssize_t __pyx_t_39;
19887  Py_ssize_t __pyx_t_40;
19888  Py_ssize_t __pyx_t_41;
19889  Py_ssize_t __pyx_t_42;
19890  Py_ssize_t __pyx_t_43;
19891  Py_ssize_t __pyx_t_44;
19892  Py_ssize_t __pyx_t_45;
19893  Py_ssize_t __pyx_t_46;
19894  Py_ssize_t __pyx_t_47;
19895  Py_ssize_t __pyx_t_48;
19896  Py_ssize_t __pyx_t_49;
19897  Py_ssize_t __pyx_t_50;
19898  Py_ssize_t __pyx_t_51;
19899  Py_ssize_t __pyx_t_52;
19900  Py_ssize_t __pyx_t_53;
19901  Py_ssize_t __pyx_t_54;
19902  Py_ssize_t __pyx_t_55;
19903  Py_ssize_t __pyx_t_56;
19904  Py_ssize_t __pyx_t_57;
19905  __Pyx_RefNannySetupContext("helicalElementVelocityEval4", 0);
19906  __pyx_pybuffer_x.pybuffer.buf = NULL;
19907  __pyx_pybuffer_x.refcount = 0;
19908  __pyx_pybuffernd_x.data = NULL;
19909  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
19910  __pyx_pybuffer_v.pybuffer.buf = NULL;
19911  __pyx_pybuffer_v.refcount = 0;
19912  __pyx_pybuffernd_v.data = NULL;
19913  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
19914  {
19915  __Pyx_BufFmt_StackElem __pyx_stack[1];
19916  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 884, __pyx_L1_error)
19917  }
19918  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
19919  {
19920  __Pyx_BufFmt_StackElem __pyx_stack[1];
19921  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 884, __pyx_L1_error)
19922  }
19923  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
19924 
19925  /* "subsurfaceTransportFunctions.pyx":894
19926  * cdef int eN,ebN,k
19927  * cdef double pi
19928  * pi = M_PI # <<<<<<<<<<<<<<
19929  * if transient == 1:
19930  * for eN in range(x.shape[0]):
19931  */
19932  __pyx_v_pi = M_PI;
19933 
19934  /* "subsurfaceTransportFunctions.pyx":895
19935  * cdef double pi
19936  * pi = M_PI
19937  * if transient == 1: # <<<<<<<<<<<<<<
19938  * for eN in range(x.shape[0]):
19939  * for ebN in range(x.shape[1]):
19940  */
19941  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
19942  if (__pyx_t_1) {
19943 
19944  /* "subsurfaceTransportFunctions.pyx":896
19945  * pi = M_PI
19946  * if transient == 1:
19947  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
19948  * for ebN in range(x.shape[1]):
19949  * for k in range(x.shape[2]):
19950  */
19951  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
19952  __pyx_t_3 = __pyx_t_2;
19953  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19954  __pyx_v_eN = __pyx_t_4;
19955 
19956  /* "subsurfaceTransportFunctions.pyx":897
19957  * if transient == 1:
19958  * for eN in range(x.shape[0]):
19959  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
19960  * for k in range(x.shape[2]):
19961  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
19962  */
19963  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
19964  __pyx_t_6 = __pyx_t_5;
19965  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
19966  __pyx_v_ebN = __pyx_t_7;
19967 
19968  /* "subsurfaceTransportFunctions.pyx":898
19969  * for eN in range(x.shape[0]):
19970  * for ebN in range(x.shape[1]):
19971  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
19972  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
19973  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19974  */
19975  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
19976  __pyx_t_9 = __pyx_t_8;
19977  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
19978  __pyx_v_k = __pyx_t_10;
19979 
19980  /* "subsurfaceTransportFunctions.pyx":899
19981  * for ebN in range(x.shape[1]):
19982  * for k in range(x.shape[2]):
19983  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
19984  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19985  * v[eN,ebN,k,2]=zVelocity
19986  */
19987  __pyx_t_11 = __pyx_v_eN;
19988  __pyx_t_12 = __pyx_v_ebN;
19989  __pyx_t_13 = __pyx_v_k;
19990  __pyx_t_14 = 1;
19991  __pyx_t_15 = -1;
19992  if (__pyx_t_11 < 0) {
19993  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
19994  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
19995  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
19996  if (__pyx_t_12 < 0) {
19997  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
19998  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
19999  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
20000  if (__pyx_t_13 < 0) {
20001  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
20002  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
20003  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
20004  if (__pyx_t_14 < 0) {
20005  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[3].shape;
20006  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
20007  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
20008  if (unlikely(__pyx_t_15 != -1)) {
20009  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20010  __PYX_ERR(0, 899, __pyx_L1_error)
20011  }
20012  __pyx_t_16 = __pyx_v_eN;
20013  __pyx_t_17 = __pyx_v_ebN;
20014  __pyx_t_18 = __pyx_v_k;
20015  __pyx_t_19 = 0;
20016  __pyx_t_15 = -1;
20017  if (__pyx_t_16 < 0) {
20018  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
20019  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
20020  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
20021  if (__pyx_t_17 < 0) {
20022  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
20023  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 1;
20024  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
20025  if (__pyx_t_18 < 0) {
20026  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
20027  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 2;
20028  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
20029  if (__pyx_t_19 < 0) {
20030  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[3].shape;
20031  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 3;
20032  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
20033  if (unlikely(__pyx_t_15 != -1)) {
20034  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20035  __PYX_ERR(0, 899, __pyx_L1_error)
20036  }
20037  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
20038 
20039  /* "subsurfaceTransportFunctions.pyx":900
20040  * for k in range(x.shape[2]):
20041  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
20042  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
20043  * v[eN,ebN,k,2]=zVelocity
20044  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
20045  */
20046  __pyx_t_20 = __pyx_v_eN;
20047  __pyx_t_21 = __pyx_v_ebN;
20048  __pyx_t_22 = __pyx_v_k;
20049  __pyx_t_23 = 0;
20050  __pyx_t_15 = -1;
20051  if (__pyx_t_20 < 0) {
20052  __pyx_t_20 += __pyx_pybuffernd_x.diminfo[0].shape;
20053  if (unlikely(__pyx_t_20 < 0)) __pyx_t_15 = 0;
20054  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
20055  if (__pyx_t_21 < 0) {
20056  __pyx_t_21 += __pyx_pybuffernd_x.diminfo[1].shape;
20057  if (unlikely(__pyx_t_21 < 0)) __pyx_t_15 = 1;
20058  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
20059  if (__pyx_t_22 < 0) {
20060  __pyx_t_22 += __pyx_pybuffernd_x.diminfo[2].shape;
20061  if (unlikely(__pyx_t_22 < 0)) __pyx_t_15 = 2;
20062  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
20063  if (__pyx_t_23 < 0) {
20064  __pyx_t_23 += __pyx_pybuffernd_x.diminfo[3].shape;
20065  if (unlikely(__pyx_t_23 < 0)) __pyx_t_15 = 3;
20066  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
20067  if (unlikely(__pyx_t_15 != -1)) {
20068  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20069  __PYX_ERR(0, 900, __pyx_L1_error)
20070  }
20071  __pyx_t_24 = __pyx_v_eN;
20072  __pyx_t_25 = __pyx_v_ebN;
20073  __pyx_t_26 = __pyx_v_k;
20074  __pyx_t_27 = 1;
20075  __pyx_t_15 = -1;
20076  if (__pyx_t_24 < 0) {
20077  __pyx_t_24 += __pyx_pybuffernd_v.diminfo[0].shape;
20078  if (unlikely(__pyx_t_24 < 0)) __pyx_t_15 = 0;
20079  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
20080  if (__pyx_t_25 < 0) {
20081  __pyx_t_25 += __pyx_pybuffernd_v.diminfo[1].shape;
20082  if (unlikely(__pyx_t_25 < 0)) __pyx_t_15 = 1;
20083  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
20084  if (__pyx_t_26 < 0) {
20085  __pyx_t_26 += __pyx_pybuffernd_v.diminfo[2].shape;
20086  if (unlikely(__pyx_t_26 < 0)) __pyx_t_15 = 2;
20087  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
20088  if (__pyx_t_27 < 0) {
20089  __pyx_t_27 += __pyx_pybuffernd_v.diminfo[3].shape;
20090  if (unlikely(__pyx_t_27 < 0)) __pyx_t_15 = 3;
20091  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
20092  if (unlikely(__pyx_t_15 != -1)) {
20093  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20094  __PYX_ERR(0, 900, __pyx_L1_error)
20095  }
20096  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_26, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_27, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_22, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_23, __pyx_pybuffernd_x.diminfo[3].strides))));
20097 
20098  /* "subsurfaceTransportFunctions.pyx":901
20099  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
20100  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
20101  * v[eN,ebN,k,2]=zVelocity # <<<<<<<<<<<<<<
20102  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
20103  * else:
20104  */
20105  __pyx_t_28 = __pyx_v_eN;
20106  __pyx_t_29 = __pyx_v_ebN;
20107  __pyx_t_30 = __pyx_v_k;
20108  __pyx_t_31 = 2;
20109  __pyx_t_15 = -1;
20110  if (__pyx_t_28 < 0) {
20111  __pyx_t_28 += __pyx_pybuffernd_v.diminfo[0].shape;
20112  if (unlikely(__pyx_t_28 < 0)) __pyx_t_15 = 0;
20113  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
20114  if (__pyx_t_29 < 0) {
20115  __pyx_t_29 += __pyx_pybuffernd_v.diminfo[1].shape;
20116  if (unlikely(__pyx_t_29 < 0)) __pyx_t_15 = 1;
20117  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
20118  if (__pyx_t_30 < 0) {
20119  __pyx_t_30 += __pyx_pybuffernd_v.diminfo[2].shape;
20120  if (unlikely(__pyx_t_30 < 0)) __pyx_t_15 = 2;
20121  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
20122  if (__pyx_t_31 < 0) {
20123  __pyx_t_31 += __pyx_pybuffernd_v.diminfo[3].shape;
20124  if (unlikely(__pyx_t_31 < 0)) __pyx_t_15 = 3;
20125  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
20126  if (unlikely(__pyx_t_15 != -1)) {
20127  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20128  __PYX_ERR(0, 901, __pyx_L1_error)
20129  }
20130  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_30, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_31, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zVelocity;
20131 
20132  /* "subsurfaceTransportFunctions.pyx":902
20133  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
20134  * v[eN,ebN,k,2]=zVelocity
20135  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0)) # <<<<<<<<<<<<<<
20136  * else:
20137  * for eN in range(x.shape[0]):
20138  */
20139  __pyx_t_32 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_32)) __PYX_ERR(0, 902, __pyx_L1_error)
20140  __Pyx_GOTREF(__pyx_t_32);
20141  __pyx_t_33 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 902, __pyx_L1_error)
20142  __Pyx_GOTREF(__pyx_t_33);
20143  __pyx_t_34 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 902, __pyx_L1_error)
20144  __Pyx_GOTREF(__pyx_t_34);
20145  __pyx_t_35 = PyTuple_New(4); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 902, __pyx_L1_error)
20146  __Pyx_GOTREF(__pyx_t_35);
20147  __Pyx_GIVEREF(__pyx_t_32);
20148  PyTuple_SET_ITEM(__pyx_t_35, 0, __pyx_t_32);
20149  __Pyx_GIVEREF(__pyx_t_33);
20150  PyTuple_SET_ITEM(__pyx_t_35, 1, __pyx_t_33);
20151  __Pyx_GIVEREF(__pyx_t_34);
20152  PyTuple_SET_ITEM(__pyx_t_35, 2, __pyx_t_34);
20153  __Pyx_INCREF(__pyx_slice_);
20154  __Pyx_GIVEREF(__pyx_slice_);
20155  PyTuple_SET_ITEM(__pyx_t_35, 3, __pyx_slice_);
20156  __pyx_t_32 = 0;
20157  __pyx_t_33 = 0;
20158  __pyx_t_34 = 0;
20159  __pyx_t_34 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_35); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 902, __pyx_L1_error)
20160  __Pyx_GOTREF(__pyx_t_34);
20161  __pyx_t_36 = (__pyx_v_pi * __pyx_v_t);
20162  __pyx_t_37 = (__pyx_v_tForReversal * 2.0);
20163  if (unlikely(__pyx_t_37 == 0)) {
20164  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
20165  __PYX_ERR(0, 902, __pyx_L1_error)
20166  }
20167  __pyx_t_33 = PyFloat_FromDouble((__pyx_v_clock * cos((__pyx_t_36 / __pyx_t_37)))); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 902, __pyx_L1_error)
20168  __Pyx_GOTREF(__pyx_t_33);
20169  __pyx_t_32 = PyNumber_InPlaceMultiply(__pyx_t_34, __pyx_t_33); if (unlikely(!__pyx_t_32)) __PYX_ERR(0, 902, __pyx_L1_error)
20170  __Pyx_GOTREF(__pyx_t_32);
20171  __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
20172  __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
20173  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_35, __pyx_t_32) < 0)) __PYX_ERR(0, 902, __pyx_L1_error)
20174  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
20175  __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
20176  }
20177  }
20178  }
20179 
20180  /* "subsurfaceTransportFunctions.pyx":895
20181  * cdef double pi
20182  * pi = M_PI
20183  * if transient == 1: # <<<<<<<<<<<<<<
20184  * for eN in range(x.shape[0]):
20185  * for ebN in range(x.shape[1]):
20186  */
20187  goto __pyx_L3;
20188  }
20189 
20190  /* "subsurfaceTransportFunctions.pyx":904
20191  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
20192  * else:
20193  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
20194  * for ebN in range(x.shape[1]):
20195  * for k in range(x.shape[2]):
20196  */
20197  /*else*/ {
20198  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
20199  __pyx_t_3 = __pyx_t_2;
20200  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
20201  __pyx_v_eN = __pyx_t_4;
20202 
20203  /* "subsurfaceTransportFunctions.pyx":905
20204  * else:
20205  * for eN in range(x.shape[0]):
20206  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
20207  * for k in range(x.shape[2]):
20208  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
20209  */
20210  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
20211  __pyx_t_6 = __pyx_t_5;
20212  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
20213  __pyx_v_ebN = __pyx_t_7;
20214 
20215  /* "subsurfaceTransportFunctions.pyx":906
20216  * for eN in range(x.shape[0]):
20217  * for ebN in range(x.shape[1]):
20218  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
20219  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
20220  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
20221  */
20222  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
20223  __pyx_t_9 = __pyx_t_8;
20224  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
20225  __pyx_v_k = __pyx_t_10;
20226 
20227  /* "subsurfaceTransportFunctions.pyx":907
20228  * for ebN in range(x.shape[1]):
20229  * for k in range(x.shape[2]):
20230  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
20231  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
20232  * v[eN,ebN,k,2]=zVelocity
20233  */
20234  __pyx_t_38 = __pyx_v_eN;
20235  __pyx_t_39 = __pyx_v_ebN;
20236  __pyx_t_40 = __pyx_v_k;
20237  __pyx_t_41 = 1;
20238  __pyx_t_15 = -1;
20239  if (__pyx_t_38 < 0) {
20240  __pyx_t_38 += __pyx_pybuffernd_x.diminfo[0].shape;
20241  if (unlikely(__pyx_t_38 < 0)) __pyx_t_15 = 0;
20242  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
20243  if (__pyx_t_39 < 0) {
20244  __pyx_t_39 += __pyx_pybuffernd_x.diminfo[1].shape;
20245  if (unlikely(__pyx_t_39 < 0)) __pyx_t_15 = 1;
20246  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
20247  if (__pyx_t_40 < 0) {
20248  __pyx_t_40 += __pyx_pybuffernd_x.diminfo[2].shape;
20249  if (unlikely(__pyx_t_40 < 0)) __pyx_t_15 = 2;
20250  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
20251  if (__pyx_t_41 < 0) {
20252  __pyx_t_41 += __pyx_pybuffernd_x.diminfo[3].shape;
20253  if (unlikely(__pyx_t_41 < 0)) __pyx_t_15 = 3;
20254  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
20255  if (unlikely(__pyx_t_15 != -1)) {
20256  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20257  __PYX_ERR(0, 907, __pyx_L1_error)
20258  }
20259  __pyx_t_42 = __pyx_v_eN;
20260  __pyx_t_43 = __pyx_v_ebN;
20261  __pyx_t_44 = __pyx_v_k;
20262  __pyx_t_45 = 0;
20263  __pyx_t_15 = -1;
20264  if (__pyx_t_42 < 0) {
20265  __pyx_t_42 += __pyx_pybuffernd_v.diminfo[0].shape;
20266  if (unlikely(__pyx_t_42 < 0)) __pyx_t_15 = 0;
20267  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
20268  if (__pyx_t_43 < 0) {
20269  __pyx_t_43 += __pyx_pybuffernd_v.diminfo[1].shape;
20270  if (unlikely(__pyx_t_43 < 0)) __pyx_t_15 = 1;
20271  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
20272  if (__pyx_t_44 < 0) {
20273  __pyx_t_44 += __pyx_pybuffernd_v.diminfo[2].shape;
20274  if (unlikely(__pyx_t_44 < 0)) __pyx_t_15 = 2;
20275  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
20276  if (__pyx_t_45 < 0) {
20277  __pyx_t_45 += __pyx_pybuffernd_v.diminfo[3].shape;
20278  if (unlikely(__pyx_t_45 < 0)) __pyx_t_15 = 3;
20279  } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
20280  if (unlikely(__pyx_t_15 != -1)) {
20281  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20282  __PYX_ERR(0, 907, __pyx_L1_error)
20283  }
20284  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_44, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_45, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_40, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_41, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
20285 
20286  /* "subsurfaceTransportFunctions.pyx":908
20287  * for k in range(x.shape[2]):
20288  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
20289  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
20290  * v[eN,ebN,k,2]=zVelocity
20291  *
20292  */
20293  __pyx_t_46 = __pyx_v_eN;
20294  __pyx_t_47 = __pyx_v_ebN;
20295  __pyx_t_48 = __pyx_v_k;
20296  __pyx_t_49 = 0;
20297  __pyx_t_15 = -1;
20298  if (__pyx_t_46 < 0) {
20299  __pyx_t_46 += __pyx_pybuffernd_x.diminfo[0].shape;
20300  if (unlikely(__pyx_t_46 < 0)) __pyx_t_15 = 0;
20301  } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
20302  if (__pyx_t_47 < 0) {
20303  __pyx_t_47 += __pyx_pybuffernd_x.diminfo[1].shape;
20304  if (unlikely(__pyx_t_47 < 0)) __pyx_t_15 = 1;
20305  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
20306  if (__pyx_t_48 < 0) {
20307  __pyx_t_48 += __pyx_pybuffernd_x.diminfo[2].shape;
20308  if (unlikely(__pyx_t_48 < 0)) __pyx_t_15 = 2;
20309  } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
20310  if (__pyx_t_49 < 0) {
20311  __pyx_t_49 += __pyx_pybuffernd_x.diminfo[3].shape;
20312  if (unlikely(__pyx_t_49 < 0)) __pyx_t_15 = 3;
20313  } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
20314  if (unlikely(__pyx_t_15 != -1)) {
20315  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20316  __PYX_ERR(0, 908, __pyx_L1_error)
20317  }
20318  __pyx_t_50 = __pyx_v_eN;
20319  __pyx_t_51 = __pyx_v_ebN;
20320  __pyx_t_52 = __pyx_v_k;
20321  __pyx_t_53 = 1;
20322  __pyx_t_15 = -1;
20323  if (__pyx_t_50 < 0) {
20324  __pyx_t_50 += __pyx_pybuffernd_v.diminfo[0].shape;
20325  if (unlikely(__pyx_t_50 < 0)) __pyx_t_15 = 0;
20326  } else if (unlikely(__pyx_t_50 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
20327  if (__pyx_t_51 < 0) {
20328  __pyx_t_51 += __pyx_pybuffernd_v.diminfo[1].shape;
20329  if (unlikely(__pyx_t_51 < 0)) __pyx_t_15 = 1;
20330  } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
20331  if (__pyx_t_52 < 0) {
20332  __pyx_t_52 += __pyx_pybuffernd_v.diminfo[2].shape;
20333  if (unlikely(__pyx_t_52 < 0)) __pyx_t_15 = 2;
20334  } else if (unlikely(__pyx_t_52 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
20335  if (__pyx_t_53 < 0) {
20336  __pyx_t_53 += __pyx_pybuffernd_v.diminfo[3].shape;
20337  if (unlikely(__pyx_t_53 < 0)) __pyx_t_15 = 3;
20338  } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
20339  if (unlikely(__pyx_t_15 != -1)) {
20340  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20341  __PYX_ERR(0, 908, __pyx_L1_error)
20342  }
20343  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_51, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_52, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_53, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_48, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_49, __pyx_pybuffernd_x.diminfo[3].strides))));
20344 
20345  /* "subsurfaceTransportFunctions.pyx":909
20346  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
20347  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
20348  * v[eN,ebN,k,2]=zVelocity # <<<<<<<<<<<<<<
20349  *
20350  * def vortexElementVelocityEval3(double t,
20351  */
20352  __pyx_t_54 = __pyx_v_eN;
20353  __pyx_t_55 = __pyx_v_ebN;
20354  __pyx_t_56 = __pyx_v_k;
20355  __pyx_t_57 = 2;
20356  __pyx_t_15 = -1;
20357  if (__pyx_t_54 < 0) {
20358  __pyx_t_54 += __pyx_pybuffernd_v.diminfo[0].shape;
20359  if (unlikely(__pyx_t_54 < 0)) __pyx_t_15 = 0;
20360  } else if (unlikely(__pyx_t_54 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
20361  if (__pyx_t_55 < 0) {
20362  __pyx_t_55 += __pyx_pybuffernd_v.diminfo[1].shape;
20363  if (unlikely(__pyx_t_55 < 0)) __pyx_t_15 = 1;
20364  } else if (unlikely(__pyx_t_55 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
20365  if (__pyx_t_56 < 0) {
20366  __pyx_t_56 += __pyx_pybuffernd_v.diminfo[2].shape;
20367  if (unlikely(__pyx_t_56 < 0)) __pyx_t_15 = 2;
20368  } else if (unlikely(__pyx_t_56 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
20369  if (__pyx_t_57 < 0) {
20370  __pyx_t_57 += __pyx_pybuffernd_v.diminfo[3].shape;
20371  if (unlikely(__pyx_t_57 < 0)) __pyx_t_15 = 3;
20372  } else if (unlikely(__pyx_t_57 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
20373  if (unlikely(__pyx_t_15 != -1)) {
20374  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20375  __PYX_ERR(0, 909, __pyx_L1_error)
20376  }
20377  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_55, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_56, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_57, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zVelocity;
20378  }
20379  }
20380  }
20381  }
20382  __pyx_L3:;
20383 
20384  /* "subsurfaceTransportFunctions.pyx":884
20385  * v[eN,k,2]=zVelocity
20386  *
20387  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
20388  * double t,
20389  * double tForReversal,
20390  */
20391 
20392  /* function exit code */
20393  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20394  goto __pyx_L0;
20395  __pyx_L1_error:;
20396  __Pyx_XDECREF(__pyx_t_32);
20397  __Pyx_XDECREF(__pyx_t_33);
20398  __Pyx_XDECREF(__pyx_t_34);
20399  __Pyx_XDECREF(__pyx_t_35);
20400  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
20401  __Pyx_PyThreadState_declare
20402  __Pyx_PyThreadState_assign
20403  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
20404  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
20405  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
20406  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
20407  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
20408  __pyx_r = NULL;
20409  goto __pyx_L2;
20410  __pyx_L0:;
20411  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
20412  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
20413  __pyx_L2:;
20414  __Pyx_XGIVEREF(__pyx_r);
20415  __Pyx_RefNannyFinishContext();
20416  return __pyx_r;
20417 }
20418 
20419 /* "subsurfaceTransportFunctions.pyx":911
20420  * v[eN,ebN,k,2]=zVelocity
20421  *
20422  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
20423  * numpy.ndarray[DTYPE_t,ndim=3] x,
20424  * numpy.ndarray[DTYPE_t,ndim=3] v):
20425  */
20426 
20427 /* Python wrapper */
20428 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_55vortexElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
20429 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_55vortexElementVelocityEval3 = {"vortexElementVelocityEval3", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_55vortexElementVelocityEval3, METH_VARARGS|METH_KEYWORDS, 0};
20430 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_55vortexElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
20431  double __pyx_v_t;
20432  PyArrayObject *__pyx_v_x = 0;
20433  PyArrayObject *__pyx_v_v = 0;
20434  PyObject *__pyx_r = 0;
20435  __Pyx_RefNannyDeclarations
20436  __Pyx_RefNannySetupContext("vortexElementVelocityEval3 (wrapper)", 0);
20437  {
20438  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_x,&__pyx_n_s_v,0};
20439  PyObject* values[3] = {0,0,0};
20440  if (unlikely(__pyx_kwds)) {
20441  Py_ssize_t kw_args;
20442  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
20443  switch (pos_args) {
20444  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20445  CYTHON_FALLTHROUGH;
20446  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20447  CYTHON_FALLTHROUGH;
20448  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20449  CYTHON_FALLTHROUGH;
20450  case 0: break;
20451  default: goto __pyx_L5_argtuple_error;
20452  }
20453  kw_args = PyDict_Size(__pyx_kwds);
20454  switch (pos_args) {
20455  case 0:
20456  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
20457  else goto __pyx_L5_argtuple_error;
20458  CYTHON_FALLTHROUGH;
20459  case 1:
20460  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
20461  else {
20462  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval3", 1, 3, 3, 1); __PYX_ERR(0, 911, __pyx_L3_error)
20463  }
20464  CYTHON_FALLTHROUGH;
20465  case 2:
20466  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
20467  else {
20468  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval3", 1, 3, 3, 2); __PYX_ERR(0, 911, __pyx_L3_error)
20469  }
20470  }
20471  if (unlikely(kw_args > 0)) {
20472  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vortexElementVelocityEval3") < 0)) __PYX_ERR(0, 911, __pyx_L3_error)
20473  }
20474  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
20475  goto __pyx_L5_argtuple_error;
20476  } else {
20477  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20478  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20479  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20480  }
20481  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 911, __pyx_L3_error)
20482  __pyx_v_x = ((PyArrayObject *)values[1]);
20483  __pyx_v_v = ((PyArrayObject *)values[2]);
20484  }
20485  goto __pyx_L4_argument_unpacking_done;
20486  __pyx_L5_argtuple_error:;
20487  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval3", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 911, __pyx_L3_error)
20488  __pyx_L3_error:;
20489  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
20490  __Pyx_RefNannyFinishContext();
20491  return NULL;
20492  __pyx_L4_argument_unpacking_done:;
20493  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 912, __pyx_L1_error)
20494  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 913, __pyx_L1_error)
20495  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_54vortexElementVelocityEval3(__pyx_self, __pyx_v_t, __pyx_v_x, __pyx_v_v);
20496 
20497  /* function exit code */
20498  goto __pyx_L0;
20499  __pyx_L1_error:;
20500  __pyx_r = NULL;
20501  __pyx_L0:;
20502  __Pyx_RefNannyFinishContext();
20503  return __pyx_r;
20504 }
20505 
20506 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_54vortexElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
20507  int __pyx_v_eN;
20508  int __pyx_v_k;
20509  double __pyx_v_pi;
20510  double __pyx_v_one8;
20511  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
20512  __Pyx_Buffer __pyx_pybuffer_v;
20513  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
20514  __Pyx_Buffer __pyx_pybuffer_x;
20515  PyObject *__pyx_r = NULL;
20516  __Pyx_RefNannyDeclarations
20517  npy_intp __pyx_t_1;
20518  npy_intp __pyx_t_2;
20519  int __pyx_t_3;
20520  npy_intp __pyx_t_4;
20521  npy_intp __pyx_t_5;
20522  int __pyx_t_6;
20523  Py_ssize_t __pyx_t_7;
20524  Py_ssize_t __pyx_t_8;
20525  Py_ssize_t __pyx_t_9;
20526  int __pyx_t_10;
20527  Py_ssize_t __pyx_t_11;
20528  Py_ssize_t __pyx_t_12;
20529  Py_ssize_t __pyx_t_13;
20530  Py_ssize_t __pyx_t_14;
20531  Py_ssize_t __pyx_t_15;
20532  Py_ssize_t __pyx_t_16;
20533  Py_ssize_t __pyx_t_17;
20534  Py_ssize_t __pyx_t_18;
20535  Py_ssize_t __pyx_t_19;
20536  Py_ssize_t __pyx_t_20;
20537  Py_ssize_t __pyx_t_21;
20538  Py_ssize_t __pyx_t_22;
20539  Py_ssize_t __pyx_t_23;
20540  Py_ssize_t __pyx_t_24;
20541  Py_ssize_t __pyx_t_25;
20542  Py_ssize_t __pyx_t_26;
20543  Py_ssize_t __pyx_t_27;
20544  Py_ssize_t __pyx_t_28;
20545  Py_ssize_t __pyx_t_29;
20546  Py_ssize_t __pyx_t_30;
20547  Py_ssize_t __pyx_t_31;
20548  __Pyx_RefNannySetupContext("vortexElementVelocityEval3", 0);
20549  __pyx_pybuffer_x.pybuffer.buf = NULL;
20550  __pyx_pybuffer_x.refcount = 0;
20551  __pyx_pybuffernd_x.data = NULL;
20552  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
20553  __pyx_pybuffer_v.pybuffer.buf = NULL;
20554  __pyx_pybuffer_v.refcount = 0;
20555  __pyx_pybuffernd_v.data = NULL;
20556  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
20557  {
20558  __Pyx_BufFmt_StackElem __pyx_stack[1];
20559  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 911, __pyx_L1_error)
20560  }
20561  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
20562  {
20563  __Pyx_BufFmt_StackElem __pyx_stack[1];
20564  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 911, __pyx_L1_error)
20565  }
20566  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
20567 
20568  /* "subsurfaceTransportFunctions.pyx":916
20569  * cdef int eN,k
20570  * cdef double pi,one8
20571  * pi = M_PI # <<<<<<<<<<<<<<
20572  * one8 = 1.0/8.0
20573  * for eN in range(x.shape[0]):
20574  */
20575  __pyx_v_pi = M_PI;
20576 
20577  /* "subsurfaceTransportFunctions.pyx":917
20578  * cdef double pi,one8
20579  * pi = M_PI
20580  * one8 = 1.0/8.0 # <<<<<<<<<<<<<<
20581  * for eN in range(x.shape[0]):
20582  * for k in range(x.shape[1]):
20583  */
20584  __pyx_v_one8 = (1.0 / 8.0);
20585 
20586  /* "subsurfaceTransportFunctions.pyx":918
20587  * pi = M_PI
20588  * one8 = 1.0/8.0
20589  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
20590  * for k in range(x.shape[1]):
20591  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]);
20592  */
20593  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
20594  __pyx_t_2 = __pyx_t_1;
20595  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
20596  __pyx_v_eN = __pyx_t_3;
20597 
20598  /* "subsurfaceTransportFunctions.pyx":919
20599  * one8 = 1.0/8.0
20600  * for eN in range(x.shape[0]):
20601  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
20602  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]);
20603  * v[eN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,k,0])*sin(pi*x[eN,k,1])*sin(pi*x[eN,k,1]);
20604  */
20605  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
20606  __pyx_t_5 = __pyx_t_4;
20607  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
20608  __pyx_v_k = __pyx_t_6;
20609 
20610  /* "subsurfaceTransportFunctions.pyx":920
20611  * for eN in range(x.shape[0]):
20612  * for k in range(x.shape[1]):
20613  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]); # <<<<<<<<<<<<<<
20614  * v[eN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,k,0])*sin(pi*x[eN,k,1])*sin(pi*x[eN,k,1]);
20615  *
20616  */
20617  __pyx_t_7 = __pyx_v_eN;
20618  __pyx_t_8 = __pyx_v_k;
20619  __pyx_t_9 = 1;
20620  __pyx_t_10 = -1;
20621  if (__pyx_t_7 < 0) {
20622  __pyx_t_7 += __pyx_pybuffernd_x.diminfo[0].shape;
20623  if (unlikely(__pyx_t_7 < 0)) __pyx_t_10 = 0;
20624  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20625  if (__pyx_t_8 < 0) {
20626  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[1].shape;
20627  if (unlikely(__pyx_t_8 < 0)) __pyx_t_10 = 1;
20628  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20629  if (__pyx_t_9 < 0) {
20630  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[2].shape;
20631  if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 2;
20632  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20633  if (unlikely(__pyx_t_10 != -1)) {
20634  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20635  __PYX_ERR(0, 920, __pyx_L1_error)
20636  }
20637  __pyx_t_11 = __pyx_v_eN;
20638  __pyx_t_12 = __pyx_v_k;
20639  __pyx_t_13 = 0;
20640  __pyx_t_10 = -1;
20641  if (__pyx_t_11 < 0) {
20642  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
20643  if (unlikely(__pyx_t_11 < 0)) __pyx_t_10 = 0;
20644  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20645  if (__pyx_t_12 < 0) {
20646  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
20647  if (unlikely(__pyx_t_12 < 0)) __pyx_t_10 = 1;
20648  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20649  if (__pyx_t_13 < 0) {
20650  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
20651  if (unlikely(__pyx_t_13 < 0)) __pyx_t_10 = 2;
20652  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20653  if (unlikely(__pyx_t_10 != -1)) {
20654  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20655  __PYX_ERR(0, 920, __pyx_L1_error)
20656  }
20657  __pyx_t_14 = __pyx_v_eN;
20658  __pyx_t_15 = __pyx_v_k;
20659  __pyx_t_16 = 0;
20660  __pyx_t_10 = -1;
20661  if (__pyx_t_14 < 0) {
20662  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[0].shape;
20663  if (unlikely(__pyx_t_14 < 0)) __pyx_t_10 = 0;
20664  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20665  if (__pyx_t_15 < 0) {
20666  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[1].shape;
20667  if (unlikely(__pyx_t_15 < 0)) __pyx_t_10 = 1;
20668  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20669  if (__pyx_t_16 < 0) {
20670  __pyx_t_16 += __pyx_pybuffernd_x.diminfo[2].shape;
20671  if (unlikely(__pyx_t_16 < 0)) __pyx_t_10 = 2;
20672  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20673  if (unlikely(__pyx_t_10 != -1)) {
20674  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20675  __PYX_ERR(0, 920, __pyx_L1_error)
20676  }
20677  __pyx_t_17 = __pyx_v_eN;
20678  __pyx_t_18 = __pyx_v_k;
20679  __pyx_t_19 = 0;
20680  __pyx_t_10 = -1;
20681  if (__pyx_t_17 < 0) {
20682  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[0].shape;
20683  if (unlikely(__pyx_t_17 < 0)) __pyx_t_10 = 0;
20684  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_10 = 0;
20685  if (__pyx_t_18 < 0) {
20686  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
20687  if (unlikely(__pyx_t_18 < 0)) __pyx_t_10 = 1;
20688  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_10 = 1;
20689  if (__pyx_t_19 < 0) {
20690  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[2].shape;
20691  if (unlikely(__pyx_t_19 < 0)) __pyx_t_10 = 2;
20692  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_10 = 2;
20693  if (unlikely(__pyx_t_10 != -1)) {
20694  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20695  __PYX_ERR(0, 920, __pyx_L1_error)
20696  }
20697  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[2].strides) = (((cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t)) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_16, __pyx_pybuffernd_x.diminfo[2].strides)))));
20698 
20699  /* "subsurfaceTransportFunctions.pyx":921
20700  * for k in range(x.shape[1]):
20701  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]);
20702  * v[eN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,k,0])*sin(pi*x[eN,k,1])*sin(pi*x[eN,k,1]); # <<<<<<<<<<<<<<
20703  *
20704  *
20705  */
20706  __pyx_t_20 = __pyx_v_eN;
20707  __pyx_t_21 = __pyx_v_k;
20708  __pyx_t_22 = 0;
20709  __pyx_t_10 = -1;
20710  if (__pyx_t_20 < 0) {
20711  __pyx_t_20 += __pyx_pybuffernd_x.diminfo[0].shape;
20712  if (unlikely(__pyx_t_20 < 0)) __pyx_t_10 = 0;
20713  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20714  if (__pyx_t_21 < 0) {
20715  __pyx_t_21 += __pyx_pybuffernd_x.diminfo[1].shape;
20716  if (unlikely(__pyx_t_21 < 0)) __pyx_t_10 = 1;
20717  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20718  if (__pyx_t_22 < 0) {
20719  __pyx_t_22 += __pyx_pybuffernd_x.diminfo[2].shape;
20720  if (unlikely(__pyx_t_22 < 0)) __pyx_t_10 = 2;
20721  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20722  if (unlikely(__pyx_t_10 != -1)) {
20723  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20724  __PYX_ERR(0, 921, __pyx_L1_error)
20725  }
20726  __pyx_t_23 = __pyx_v_eN;
20727  __pyx_t_24 = __pyx_v_k;
20728  __pyx_t_25 = 1;
20729  __pyx_t_10 = -1;
20730  if (__pyx_t_23 < 0) {
20731  __pyx_t_23 += __pyx_pybuffernd_x.diminfo[0].shape;
20732  if (unlikely(__pyx_t_23 < 0)) __pyx_t_10 = 0;
20733  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20734  if (__pyx_t_24 < 0) {
20735  __pyx_t_24 += __pyx_pybuffernd_x.diminfo[1].shape;
20736  if (unlikely(__pyx_t_24 < 0)) __pyx_t_10 = 1;
20737  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20738  if (__pyx_t_25 < 0) {
20739  __pyx_t_25 += __pyx_pybuffernd_x.diminfo[2].shape;
20740  if (unlikely(__pyx_t_25 < 0)) __pyx_t_10 = 2;
20741  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20742  if (unlikely(__pyx_t_10 != -1)) {
20743  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20744  __PYX_ERR(0, 921, __pyx_L1_error)
20745  }
20746  __pyx_t_26 = __pyx_v_eN;
20747  __pyx_t_27 = __pyx_v_k;
20748  __pyx_t_28 = 1;
20749  __pyx_t_10 = -1;
20750  if (__pyx_t_26 < 0) {
20751  __pyx_t_26 += __pyx_pybuffernd_x.diminfo[0].shape;
20752  if (unlikely(__pyx_t_26 < 0)) __pyx_t_10 = 0;
20753  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20754  if (__pyx_t_27 < 0) {
20755  __pyx_t_27 += __pyx_pybuffernd_x.diminfo[1].shape;
20756  if (unlikely(__pyx_t_27 < 0)) __pyx_t_10 = 1;
20757  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20758  if (__pyx_t_28 < 0) {
20759  __pyx_t_28 += __pyx_pybuffernd_x.diminfo[2].shape;
20760  if (unlikely(__pyx_t_28 < 0)) __pyx_t_10 = 2;
20761  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20762  if (unlikely(__pyx_t_10 != -1)) {
20763  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20764  __PYX_ERR(0, 921, __pyx_L1_error)
20765  }
20766  __pyx_t_29 = __pyx_v_eN;
20767  __pyx_t_30 = __pyx_v_k;
20768  __pyx_t_31 = 1;
20769  __pyx_t_10 = -1;
20770  if (__pyx_t_29 < 0) {
20771  __pyx_t_29 += __pyx_pybuffernd_v.diminfo[0].shape;
20772  if (unlikely(__pyx_t_29 < 0)) __pyx_t_10 = 0;
20773  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_10 = 0;
20774  if (__pyx_t_30 < 0) {
20775  __pyx_t_30 += __pyx_pybuffernd_v.diminfo[1].shape;
20776  if (unlikely(__pyx_t_30 < 0)) __pyx_t_10 = 1;
20777  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_10 = 1;
20778  if (__pyx_t_31 < 0) {
20779  __pyx_t_31 += __pyx_pybuffernd_v.diminfo[2].shape;
20780  if (unlikely(__pyx_t_31 < 0)) __pyx_t_10 = 2;
20781  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_10 = 2;
20782  if (unlikely(__pyx_t_10 != -1)) {
20783  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20784  __PYX_ERR(0, 921, __pyx_L1_error)
20785  }
20786  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_31, __pyx_pybuffernd_v.diminfo[2].strides) = ((((-cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t))) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_22, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_25, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_28, __pyx_pybuffernd_x.diminfo[2].strides)))));
20787  }
20788  }
20789 
20790  /* "subsurfaceTransportFunctions.pyx":911
20791  * v[eN,ebN,k,2]=zVelocity
20792  *
20793  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
20794  * numpy.ndarray[DTYPE_t,ndim=3] x,
20795  * numpy.ndarray[DTYPE_t,ndim=3] v):
20796  */
20797 
20798  /* function exit code */
20799  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20800  goto __pyx_L0;
20801  __pyx_L1_error:;
20802  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
20803  __Pyx_PyThreadState_declare
20804  __Pyx_PyThreadState_assign
20805  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
20806  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
20807  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
20808  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
20809  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
20810  __pyx_r = NULL;
20811  goto __pyx_L2;
20812  __pyx_L0:;
20813  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
20814  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
20815  __pyx_L2:;
20816  __Pyx_XGIVEREF(__pyx_r);
20817  __Pyx_RefNannyFinishContext();
20818  return __pyx_r;
20819 }
20820 
20821 /* "subsurfaceTransportFunctions.pyx":924
20822  *
20823  *
20824  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
20825  * numpy.ndarray[DTYPE_t,ndim=4] x,
20826  * numpy.ndarray[DTYPE_t,ndim=4] v):
20827  */
20828 
20829 /* Python wrapper */
20830 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_57vortexElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
20831 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_57vortexElementVelocityEval4 = {"vortexElementVelocityEval4", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_57vortexElementVelocityEval4, METH_VARARGS|METH_KEYWORDS, 0};
20832 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_57vortexElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
20833  double __pyx_v_t;
20834  PyArrayObject *__pyx_v_x = 0;
20835  PyArrayObject *__pyx_v_v = 0;
20836  PyObject *__pyx_r = 0;
20837  __Pyx_RefNannyDeclarations
20838  __Pyx_RefNannySetupContext("vortexElementVelocityEval4 (wrapper)", 0);
20839  {
20840  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_x,&__pyx_n_s_v,0};
20841  PyObject* values[3] = {0,0,0};
20842  if (unlikely(__pyx_kwds)) {
20843  Py_ssize_t kw_args;
20844  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
20845  switch (pos_args) {
20846  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20847  CYTHON_FALLTHROUGH;
20848  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20849  CYTHON_FALLTHROUGH;
20850  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20851  CYTHON_FALLTHROUGH;
20852  case 0: break;
20853  default: goto __pyx_L5_argtuple_error;
20854  }
20855  kw_args = PyDict_Size(__pyx_kwds);
20856  switch (pos_args) {
20857  case 0:
20858  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
20859  else goto __pyx_L5_argtuple_error;
20860  CYTHON_FALLTHROUGH;
20861  case 1:
20862  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
20863  else {
20864  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval4", 1, 3, 3, 1); __PYX_ERR(0, 924, __pyx_L3_error)
20865  }
20866  CYTHON_FALLTHROUGH;
20867  case 2:
20868  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
20869  else {
20870  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval4", 1, 3, 3, 2); __PYX_ERR(0, 924, __pyx_L3_error)
20871  }
20872  }
20873  if (unlikely(kw_args > 0)) {
20874  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vortexElementVelocityEval4") < 0)) __PYX_ERR(0, 924, __pyx_L3_error)
20875  }
20876  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
20877  goto __pyx_L5_argtuple_error;
20878  } else {
20879  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20880  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20881  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20882  }
20883  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 924, __pyx_L3_error)
20884  __pyx_v_x = ((PyArrayObject *)values[1]);
20885  __pyx_v_v = ((PyArrayObject *)values[2]);
20886  }
20887  goto __pyx_L4_argument_unpacking_done;
20888  __pyx_L5_argtuple_error:;
20889  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval4", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 924, __pyx_L3_error)
20890  __pyx_L3_error:;
20891  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
20892  __Pyx_RefNannyFinishContext();
20893  return NULL;
20894  __pyx_L4_argument_unpacking_done:;
20895  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 925, __pyx_L1_error)
20896  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 926, __pyx_L1_error)
20897  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_56vortexElementVelocityEval4(__pyx_self, __pyx_v_t, __pyx_v_x, __pyx_v_v);
20898 
20899  /* function exit code */
20900  goto __pyx_L0;
20901  __pyx_L1_error:;
20902  __pyx_r = NULL;
20903  __pyx_L0:;
20904  __Pyx_RefNannyFinishContext();
20905  return __pyx_r;
20906 }
20907 
20908 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_56vortexElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
20909  int __pyx_v_eN;
20910  int __pyx_v_k;
20911  int __pyx_v_ebN;
20912  double __pyx_v_pi;
20913  double __pyx_v_one8;
20914  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
20915  __Pyx_Buffer __pyx_pybuffer_v;
20916  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
20917  __Pyx_Buffer __pyx_pybuffer_x;
20918  PyObject *__pyx_r = NULL;
20919  __Pyx_RefNannyDeclarations
20920  npy_intp __pyx_t_1;
20921  npy_intp __pyx_t_2;
20922  int __pyx_t_3;
20923  npy_intp __pyx_t_4;
20924  npy_intp __pyx_t_5;
20925  int __pyx_t_6;
20926  npy_intp __pyx_t_7;
20927  npy_intp __pyx_t_8;
20928  int __pyx_t_9;
20929  Py_ssize_t __pyx_t_10;
20930  Py_ssize_t __pyx_t_11;
20931  Py_ssize_t __pyx_t_12;
20932  Py_ssize_t __pyx_t_13;
20933  int __pyx_t_14;
20934  Py_ssize_t __pyx_t_15;
20935  Py_ssize_t __pyx_t_16;
20936  Py_ssize_t __pyx_t_17;
20937  Py_ssize_t __pyx_t_18;
20938  Py_ssize_t __pyx_t_19;
20939  Py_ssize_t __pyx_t_20;
20940  Py_ssize_t __pyx_t_21;
20941  Py_ssize_t __pyx_t_22;
20942  Py_ssize_t __pyx_t_23;
20943  Py_ssize_t __pyx_t_24;
20944  Py_ssize_t __pyx_t_25;
20945  Py_ssize_t __pyx_t_26;
20946  Py_ssize_t __pyx_t_27;
20947  Py_ssize_t __pyx_t_28;
20948  Py_ssize_t __pyx_t_29;
20949  Py_ssize_t __pyx_t_30;
20950  Py_ssize_t __pyx_t_31;
20951  Py_ssize_t __pyx_t_32;
20952  Py_ssize_t __pyx_t_33;
20953  Py_ssize_t __pyx_t_34;
20954  Py_ssize_t __pyx_t_35;
20955  Py_ssize_t __pyx_t_36;
20956  Py_ssize_t __pyx_t_37;
20957  Py_ssize_t __pyx_t_38;
20958  Py_ssize_t __pyx_t_39;
20959  Py_ssize_t __pyx_t_40;
20960  Py_ssize_t __pyx_t_41;
20961  Py_ssize_t __pyx_t_42;
20962  __Pyx_RefNannySetupContext("vortexElementVelocityEval4", 0);
20963  __pyx_pybuffer_x.pybuffer.buf = NULL;
20964  __pyx_pybuffer_x.refcount = 0;
20965  __pyx_pybuffernd_x.data = NULL;
20966  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
20967  __pyx_pybuffer_v.pybuffer.buf = NULL;
20968  __pyx_pybuffer_v.refcount = 0;
20969  __pyx_pybuffernd_v.data = NULL;
20970  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
20971  {
20972  __Pyx_BufFmt_StackElem __pyx_stack[1];
20973  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 924, __pyx_L1_error)
20974  }
20975  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
20976  {
20977  __Pyx_BufFmt_StackElem __pyx_stack[1];
20978  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 924, __pyx_L1_error)
20979  }
20980  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
20981 
20982  /* "subsurfaceTransportFunctions.pyx":929
20983  * cdef int eN,k,ebN
20984  * cdef double pi,one8
20985  * pi = M_PI # <<<<<<<<<<<<<<
20986  * one8 = 1.0/8.0
20987  * for eN in range(x.shape[0]):
20988  */
20989  __pyx_v_pi = M_PI;
20990 
20991  /* "subsurfaceTransportFunctions.pyx":930
20992  * cdef double pi,one8
20993  * pi = M_PI
20994  * one8 = 1.0/8.0 # <<<<<<<<<<<<<<
20995  * for eN in range(x.shape[0]):
20996  * for ebN in range(x.shape[1]):
20997  */
20998  __pyx_v_one8 = (1.0 / 8.0);
20999 
21000  /* "subsurfaceTransportFunctions.pyx":931
21001  * pi = M_PI
21002  * one8 = 1.0/8.0
21003  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
21004  * for ebN in range(x.shape[1]):
21005  * for k in range(x.shape[2]):
21006  */
21007  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
21008  __pyx_t_2 = __pyx_t_1;
21009  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
21010  __pyx_v_eN = __pyx_t_3;
21011 
21012  /* "subsurfaceTransportFunctions.pyx":932
21013  * one8 = 1.0/8.0
21014  * for eN in range(x.shape[0]):
21015  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
21016  * for k in range(x.shape[2]):
21017  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]);
21018  */
21019  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
21020  __pyx_t_5 = __pyx_t_4;
21021  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
21022  __pyx_v_ebN = __pyx_t_6;
21023 
21024  /* "subsurfaceTransportFunctions.pyx":933
21025  * for eN in range(x.shape[0]):
21026  * for ebN in range(x.shape[1]):
21027  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
21028  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]);
21029  * v[eN,ebN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,1]);
21030  */
21031  __pyx_t_7 = (__pyx_v_x->dimensions[2]);
21032  __pyx_t_8 = __pyx_t_7;
21033  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
21034  __pyx_v_k = __pyx_t_9;
21035 
21036  /* "subsurfaceTransportFunctions.pyx":934
21037  * for ebN in range(x.shape[1]):
21038  * for k in range(x.shape[2]):
21039  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]); # <<<<<<<<<<<<<<
21040  * v[eN,ebN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,1]);
21041  *
21042  */
21043  __pyx_t_10 = __pyx_v_eN;
21044  __pyx_t_11 = __pyx_v_ebN;
21045  __pyx_t_12 = __pyx_v_k;
21046  __pyx_t_13 = 1;
21047  __pyx_t_14 = -1;
21048  if (__pyx_t_10 < 0) {
21049  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[0].shape;
21050  if (unlikely(__pyx_t_10 < 0)) __pyx_t_14 = 0;
21051  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
21052  if (__pyx_t_11 < 0) {
21053  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[1].shape;
21054  if (unlikely(__pyx_t_11 < 0)) __pyx_t_14 = 1;
21055  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
21056  if (__pyx_t_12 < 0) {
21057  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[2].shape;
21058  if (unlikely(__pyx_t_12 < 0)) __pyx_t_14 = 2;
21059  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
21060  if (__pyx_t_13 < 0) {
21061  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[3].shape;
21062  if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 3;
21063  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
21064  if (unlikely(__pyx_t_14 != -1)) {
21065  __Pyx_RaiseBufferIndexError(__pyx_t_14);
21066  __PYX_ERR(0, 934, __pyx_L1_error)
21067  }
21068  __pyx_t_15 = __pyx_v_eN;
21069  __pyx_t_16 = __pyx_v_ebN;
21070  __pyx_t_17 = __pyx_v_k;
21071  __pyx_t_18 = 0;
21072  __pyx_t_14 = -1;
21073  if (__pyx_t_15 < 0) {
21074  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[0].shape;
21075  if (unlikely(__pyx_t_15 < 0)) __pyx_t_14 = 0;
21076  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
21077  if (__pyx_t_16 < 0) {
21078  __pyx_t_16 += __pyx_pybuffernd_x.diminfo[1].shape;
21079  if (unlikely(__pyx_t_16 < 0)) __pyx_t_14 = 1;
21080  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
21081  if (__pyx_t_17 < 0) {
21082  __pyx_t_17 += __pyx_pybuffernd_x.diminfo[2].shape;
21083  if (unlikely(__pyx_t_17 < 0)) __pyx_t_14 = 2;
21084  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
21085  if (__pyx_t_18 < 0) {
21086  __pyx_t_18 += __pyx_pybuffernd_x.diminfo[3].shape;
21087  if (unlikely(__pyx_t_18 < 0)) __pyx_t_14 = 3;
21088  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
21089  if (unlikely(__pyx_t_14 != -1)) {
21090  __Pyx_RaiseBufferIndexError(__pyx_t_14);
21091  __PYX_ERR(0, 934, __pyx_L1_error)
21092  }
21093  __pyx_t_19 = __pyx_v_eN;
21094  __pyx_t_20 = __pyx_v_ebN;
21095  __pyx_t_21 = __pyx_v_k;
21096  __pyx_t_22 = 0;
21097  __pyx_t_14 = -1;
21098  if (__pyx_t_19 < 0) {
21099  __pyx_t_19 += __pyx_pybuffernd_x.diminfo[0].shape;
21100  if (unlikely(__pyx_t_19 < 0)) __pyx_t_14 = 0;
21101  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
21102  if (__pyx_t_20 < 0) {
21103  __pyx_t_20 += __pyx_pybuffernd_x.diminfo[1].shape;
21104  if (unlikely(__pyx_t_20 < 0)) __pyx_t_14 = 1;
21105  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
21106  if (__pyx_t_21 < 0) {
21107  __pyx_t_21 += __pyx_pybuffernd_x.diminfo[2].shape;
21108  if (unlikely(__pyx_t_21 < 0)) __pyx_t_14 = 2;
21109  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
21110  if (__pyx_t_22 < 0) {
21111  __pyx_t_22 += __pyx_pybuffernd_x.diminfo[3].shape;
21112  if (unlikely(__pyx_t_22 < 0)) __pyx_t_14 = 3;
21113  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
21114  if (unlikely(__pyx_t_14 != -1)) {
21115  __Pyx_RaiseBufferIndexError(__pyx_t_14);
21116  __PYX_ERR(0, 934, __pyx_L1_error)
21117  }
21118  __pyx_t_23 = __pyx_v_eN;
21119  __pyx_t_24 = __pyx_v_ebN;
21120  __pyx_t_25 = __pyx_v_k;
21121  __pyx_t_26 = 0;
21122  __pyx_t_14 = -1;
21123  if (__pyx_t_23 < 0) {
21124  __pyx_t_23 += __pyx_pybuffernd_v.diminfo[0].shape;
21125  if (unlikely(__pyx_t_23 < 0)) __pyx_t_14 = 0;
21126  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_14 = 0;
21127  if (__pyx_t_24 < 0) {
21128  __pyx_t_24 += __pyx_pybuffernd_v.diminfo[1].shape;
21129  if (unlikely(__pyx_t_24 < 0)) __pyx_t_14 = 1;
21130  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_14 = 1;
21131  if (__pyx_t_25 < 0) {
21132  __pyx_t_25 += __pyx_pybuffernd_v.diminfo[2].shape;
21133  if (unlikely(__pyx_t_25 < 0)) __pyx_t_14 = 2;
21134  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_14 = 2;
21135  if (__pyx_t_26 < 0) {
21136  __pyx_t_26 += __pyx_pybuffernd_v.diminfo[3].shape;
21137  if (unlikely(__pyx_t_26 < 0)) __pyx_t_14 = 3;
21138  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_14 = 3;
21139  if (unlikely(__pyx_t_14 != -1)) {
21140  __Pyx_RaiseBufferIndexError(__pyx_t_14);
21141  __PYX_ERR(0, 934, __pyx_L1_error)
21142  }
21143  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_25, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_26, __pyx_pybuffernd_v.diminfo[3].strides) = (((cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t)) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_18, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_22, __pyx_pybuffernd_x.diminfo[3].strides)))));
21144 
21145  /* "subsurfaceTransportFunctions.pyx":935
21146  * for k in range(x.shape[2]):
21147  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]);
21148  * v[eN,ebN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,1]); # <<<<<<<<<<<<<<
21149  *
21150  *
21151  */
21152  __pyx_t_27 = __pyx_v_eN;
21153  __pyx_t_28 = __pyx_v_ebN;
21154  __pyx_t_29 = __pyx_v_k;
21155  __pyx_t_30 = 0;
21156  __pyx_t_14 = -1;
21157  if (__pyx_t_27 < 0) {
21158  __pyx_t_27 += __pyx_pybuffernd_x.diminfo[0].shape;
21159  if (unlikely(__pyx_t_27 < 0)) __pyx_t_14 = 0;
21160  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
21161  if (__pyx_t_28 < 0) {
21162  __pyx_t_28 += __pyx_pybuffernd_x.diminfo[1].shape;
21163  if (unlikely(__pyx_t_28 < 0)) __pyx_t_14 = 1;
21164  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
21165  if (__pyx_t_29 < 0) {
21166  __pyx_t_29 += __pyx_pybuffernd_x.diminfo[2].shape;
21167  if (unlikely(__pyx_t_29 < 0)) __pyx_t_14 = 2;
21168  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
21169  if (__pyx_t_30 < 0) {
21170  __pyx_t_30 += __pyx_pybuffernd_x.diminfo[3].shape;
21171  if (unlikely(__pyx_t_30 < 0)) __pyx_t_14 = 3;
21172  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
21173  if (unlikely(__pyx_t_14 != -1)) {
21174  __Pyx_RaiseBufferIndexError(__pyx_t_14);
21175  __PYX_ERR(0, 935, __pyx_L1_error)
21176  }
21177  __pyx_t_31 = __pyx_v_eN;
21178  __pyx_t_32 = __pyx_v_ebN;
21179  __pyx_t_33 = __pyx_v_k;
21180  __pyx_t_34 = 1;
21181  __pyx_t_14 = -1;
21182  if (__pyx_t_31 < 0) {
21183  __pyx_t_31 += __pyx_pybuffernd_x.diminfo[0].shape;
21184  if (unlikely(__pyx_t_31 < 0)) __pyx_t_14 = 0;
21185  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
21186  if (__pyx_t_32 < 0) {
21187  __pyx_t_32 += __pyx_pybuffernd_x.diminfo[1].shape;
21188  if (unlikely(__pyx_t_32 < 0)) __pyx_t_14 = 1;
21189  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
21190  if (__pyx_t_33 < 0) {
21191  __pyx_t_33 += __pyx_pybuffernd_x.diminfo[2].shape;
21192  if (unlikely(__pyx_t_33 < 0)) __pyx_t_14 = 2;
21193  } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
21194  if (__pyx_t_34 < 0) {
21195  __pyx_t_34 += __pyx_pybuffernd_x.diminfo[3].shape;
21196  if (unlikely(__pyx_t_34 < 0)) __pyx_t_14 = 3;
21197  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
21198  if (unlikely(__pyx_t_14 != -1)) {
21199  __Pyx_RaiseBufferIndexError(__pyx_t_14);
21200  __PYX_ERR(0, 935, __pyx_L1_error)
21201  }
21202  __pyx_t_35 = __pyx_v_eN;
21203  __pyx_t_36 = __pyx_v_ebN;
21204  __pyx_t_37 = __pyx_v_k;
21205  __pyx_t_38 = 1;
21206  __pyx_t_14 = -1;
21207  if (__pyx_t_35 < 0) {
21208  __pyx_t_35 += __pyx_pybuffernd_x.diminfo[0].shape;
21209  if (unlikely(__pyx_t_35 < 0)) __pyx_t_14 = 0;
21210  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
21211  if (__pyx_t_36 < 0) {
21212  __pyx_t_36 += __pyx_pybuffernd_x.diminfo[1].shape;
21213  if (unlikely(__pyx_t_36 < 0)) __pyx_t_14 = 1;
21214  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
21215  if (__pyx_t_37 < 0) {
21216  __pyx_t_37 += __pyx_pybuffernd_x.diminfo[2].shape;
21217  if (unlikely(__pyx_t_37 < 0)) __pyx_t_14 = 2;
21218  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
21219  if (__pyx_t_38 < 0) {
21220  __pyx_t_38 += __pyx_pybuffernd_x.diminfo[3].shape;
21221  if (unlikely(__pyx_t_38 < 0)) __pyx_t_14 = 3;
21222  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
21223  if (unlikely(__pyx_t_14 != -1)) {
21224  __Pyx_RaiseBufferIndexError(__pyx_t_14);
21225  __PYX_ERR(0, 935, __pyx_L1_error)
21226  }
21227  __pyx_t_39 = __pyx_v_eN;
21228  __pyx_t_40 = __pyx_v_ebN;
21229  __pyx_t_41 = __pyx_v_k;
21230  __pyx_t_42 = 1;
21231  __pyx_t_14 = -1;
21232  if (__pyx_t_39 < 0) {
21233  __pyx_t_39 += __pyx_pybuffernd_v.diminfo[0].shape;
21234  if (unlikely(__pyx_t_39 < 0)) __pyx_t_14 = 0;
21235  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_14 = 0;
21236  if (__pyx_t_40 < 0) {
21237  __pyx_t_40 += __pyx_pybuffernd_v.diminfo[1].shape;
21238  if (unlikely(__pyx_t_40 < 0)) __pyx_t_14 = 1;
21239  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_14 = 1;
21240  if (__pyx_t_41 < 0) {
21241  __pyx_t_41 += __pyx_pybuffernd_v.diminfo[2].shape;
21242  if (unlikely(__pyx_t_41 < 0)) __pyx_t_14 = 2;
21243  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_14 = 2;
21244  if (__pyx_t_42 < 0) {
21245  __pyx_t_42 += __pyx_pybuffernd_v.diminfo[3].shape;
21246  if (unlikely(__pyx_t_42 < 0)) __pyx_t_14 = 3;
21247  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_14 = 3;
21248  if (unlikely(__pyx_t_14 != -1)) {
21249  __Pyx_RaiseBufferIndexError(__pyx_t_14);
21250  __PYX_ERR(0, 935, __pyx_L1_error)
21251  }
21252  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_41, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_42, __pyx_pybuffernd_v.diminfo[3].strides) = ((((-cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t))) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_29, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_30, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_33, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_34, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_37, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_38, __pyx_pybuffernd_x.diminfo[3].strides)))));
21253  }
21254  }
21255  }
21256 
21257  /* "subsurfaceTransportFunctions.pyx":924
21258  *
21259  *
21260  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
21261  * numpy.ndarray[DTYPE_t,ndim=4] x,
21262  * numpy.ndarray[DTYPE_t,ndim=4] v):
21263  */
21264 
21265  /* function exit code */
21266  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21267  goto __pyx_L0;
21268  __pyx_L1_error:;
21269  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
21270  __Pyx_PyThreadState_declare
21271  __Pyx_PyThreadState_assign
21272  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
21273  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
21274  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
21275  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
21276  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
21277  __pyx_r = NULL;
21278  goto __pyx_L2;
21279  __pyx_L0:;
21280  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
21281  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
21282  __pyx_L2:;
21283  __Pyx_XGIVEREF(__pyx_r);
21284  __Pyx_RefNannyFinishContext();
21285  return __pyx_r;
21286 }
21287 
21288 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":258
21289  * # experimental exception made for __getbuffer__ and __releasebuffer__
21290  * # -- the details of this may change.
21291  * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
21292  * # This implementation of getbuffer is geared towards Cython
21293  * # requirements, and does not yet fulfill the PEP.
21294  */
21295 
21296 /* Python wrapper */
21297 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
21298 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
21299  int __pyx_r;
21300  __Pyx_RefNannyDeclarations
21301  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
21302  __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
21303 
21304  /* function exit code */
21305  __Pyx_RefNannyFinishContext();
21306  return __pyx_r;
21307 }
21308 
21309 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
21310  int __pyx_v_i;
21311  int __pyx_v_ndim;
21312  int __pyx_v_endian_detector;
21313  int __pyx_v_little_endian;
21314  int __pyx_v_t;
21315  char *__pyx_v_f;
21316  PyArray_Descr *__pyx_v_descr = 0;
21317  int __pyx_v_offset;
21318  int __pyx_r;
21319  __Pyx_RefNannyDeclarations
21320  int __pyx_t_1;
21321  int __pyx_t_2;
21322  PyObject *__pyx_t_3 = NULL;
21323  int __pyx_t_4;
21324  int __pyx_t_5;
21325  int __pyx_t_6;
21326  PyArray_Descr *__pyx_t_7;
21327  PyObject *__pyx_t_8 = NULL;
21328  char *__pyx_t_9;
21329  if (__pyx_v_info == NULL) {
21330  PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
21331  return -1;
21332  }
21333  __Pyx_RefNannySetupContext("__getbuffer__", 0);
21334  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
21335  __Pyx_GIVEREF(__pyx_v_info->obj);
21336 
21337  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":265
21338  *
21339  * cdef int i, ndim
21340  * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
21341  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
21342  *
21343  */
21344  __pyx_v_endian_detector = 1;
21345 
21346  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":266
21347  * cdef int i, ndim
21348  * cdef int endian_detector = 1
21349  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
21350  *
21351  * ndim = PyArray_NDIM(self)
21352  */
21353  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
21354 
21355  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":268
21356  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
21357  *
21358  * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<<
21359  *
21360  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
21361  */
21362  __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
21363 
21364  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":270
21365  * ndim = PyArray_NDIM(self)
21366  *
21367  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
21368  * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
21369  * raise ValueError(u"ndarray is not C contiguous")
21370  */
21371  __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
21372  if (__pyx_t_2) {
21373  } else {
21374  __pyx_t_1 = __pyx_t_2;
21375  goto __pyx_L4_bool_binop_done;
21376  }
21377 
21378  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":271
21379  *
21380  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
21381  * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): # <<<<<<<<<<<<<<
21382  * raise ValueError(u"ndarray is not C contiguous")
21383  *
21384  */
21385  __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_C_CONTIGUOUS) != 0)) != 0);
21386  __pyx_t_1 = __pyx_t_2;
21387  __pyx_L4_bool_binop_done:;
21388 
21389  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":270
21390  * ndim = PyArray_NDIM(self)
21391  *
21392  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
21393  * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
21394  * raise ValueError(u"ndarray is not C contiguous")
21395  */
21396  if (unlikely(__pyx_t_1)) {
21397 
21398  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":272
21399  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
21400  * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
21401  * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
21402  *
21403  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
21404  */
21405  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 272, __pyx_L1_error)
21406  __Pyx_GOTREF(__pyx_t_3);
21407  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
21408  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21409  __PYX_ERR(1, 272, __pyx_L1_error)
21410 
21411  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":270
21412  * ndim = PyArray_NDIM(self)
21413  *
21414  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
21415  * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
21416  * raise ValueError(u"ndarray is not C contiguous")
21417  */
21418  }
21419 
21420  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":274
21421  * raise ValueError(u"ndarray is not C contiguous")
21422  *
21423  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
21424  * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
21425  * raise ValueError(u"ndarray is not Fortran contiguous")
21426  */
21427  __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
21428  if (__pyx_t_2) {
21429  } else {
21430  __pyx_t_1 = __pyx_t_2;
21431  goto __pyx_L7_bool_binop_done;
21432  }
21433 
21434  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":275
21435  *
21436  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
21437  * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): # <<<<<<<<<<<<<<
21438  * raise ValueError(u"ndarray is not Fortran contiguous")
21439  *
21440  */
21441  __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_F_CONTIGUOUS) != 0)) != 0);
21442  __pyx_t_1 = __pyx_t_2;
21443  __pyx_L7_bool_binop_done:;
21444 
21445  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":274
21446  * raise ValueError(u"ndarray is not C contiguous")
21447  *
21448  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
21449  * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
21450  * raise ValueError(u"ndarray is not Fortran contiguous")
21451  */
21452  if (unlikely(__pyx_t_1)) {
21453 
21454  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":276
21455  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
21456  * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
21457  * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
21458  *
21459  * info.buf = PyArray_DATA(self)
21460  */
21461  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 276, __pyx_L1_error)
21462  __Pyx_GOTREF(__pyx_t_3);
21463  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
21464  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21465  __PYX_ERR(1, 276, __pyx_L1_error)
21466 
21467  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":274
21468  * raise ValueError(u"ndarray is not C contiguous")
21469  *
21470  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
21471  * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
21472  * raise ValueError(u"ndarray is not Fortran contiguous")
21473  */
21474  }
21475 
21476  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":278
21477  * raise ValueError(u"ndarray is not Fortran contiguous")
21478  *
21479  * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<<
21480  * info.ndim = ndim
21481  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
21482  */
21483  __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
21484 
21485  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":279
21486  *
21487  * info.buf = PyArray_DATA(self)
21488  * info.ndim = ndim # <<<<<<<<<<<<<<
21489  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
21490  * # Allocate new buffer for strides and shape info.
21491  */
21492  __pyx_v_info->ndim = __pyx_v_ndim;
21493 
21494  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":280
21495  * info.buf = PyArray_DATA(self)
21496  * info.ndim = ndim
21497  * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
21498  * # Allocate new buffer for strides and shape info.
21499  * # This is allocated as one block, strides first.
21500  */
21501  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
21502  if (__pyx_t_1) {
21503 
21504  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":283
21505  * # Allocate new buffer for strides and shape info.
21506  * # This is allocated as one block, strides first.
21507  * info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim) # <<<<<<<<<<<<<<
21508  * info.shape = info.strides + ndim
21509  * for i in range(ndim):
21510  */
21511  __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim))));
21512 
21513  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":284
21514  * # This is allocated as one block, strides first.
21515  * info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
21516  * info.shape = info.strides + ndim # <<<<<<<<<<<<<<
21517  * for i in range(ndim):
21518  * info.strides[i] = PyArray_STRIDES(self)[i]
21519  */
21520  __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
21521 
21522  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":285
21523  * info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
21524  * info.shape = info.strides + ndim
21525  * for i in range(ndim): # <<<<<<<<<<<<<<
21526  * info.strides[i] = PyArray_STRIDES(self)[i]
21527  * info.shape[i] = PyArray_DIMS(self)[i]
21528  */
21529  __pyx_t_4 = __pyx_v_ndim;
21530  __pyx_t_5 = __pyx_t_4;
21531  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
21532  __pyx_v_i = __pyx_t_6;
21533 
21534  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":286
21535  * info.shape = info.strides + ndim
21536  * for i in range(ndim):
21537  * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<<
21538  * info.shape[i] = PyArray_DIMS(self)[i]
21539  * else:
21540  */
21541  (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
21542 
21543  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":287
21544  * for i in range(ndim):
21545  * info.strides[i] = PyArray_STRIDES(self)[i]
21546  * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<<
21547  * else:
21548  * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
21549  */
21550  (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
21551  }
21552 
21553  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":280
21554  * info.buf = PyArray_DATA(self)
21555  * info.ndim = ndim
21556  * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
21557  * # Allocate new buffer for strides and shape info.
21558  * # This is allocated as one block, strides first.
21559  */
21560  goto __pyx_L9;
21561  }
21562 
21563  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":289
21564  * info.shape[i] = PyArray_DIMS(self)[i]
21565  * else:
21566  * info.strides = <Py_ssize_t*>PyArray_STRIDES(self) # <<<<<<<<<<<<<<
21567  * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
21568  * info.suboffsets = NULL
21569  */
21570  /*else*/ {
21571  __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
21572 
21573  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":290
21574  * else:
21575  * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
21576  * info.shape = <Py_ssize_t*>PyArray_DIMS(self) # <<<<<<<<<<<<<<
21577  * info.suboffsets = NULL
21578  * info.itemsize = PyArray_ITEMSIZE(self)
21579  */
21580  __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
21581  }
21582  __pyx_L9:;
21583 
21584  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":291
21585  * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
21586  * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
21587  * info.suboffsets = NULL # <<<<<<<<<<<<<<
21588  * info.itemsize = PyArray_ITEMSIZE(self)
21589  * info.readonly = not PyArray_ISWRITEABLE(self)
21590  */
21591  __pyx_v_info->suboffsets = NULL;
21592 
21593  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":292
21594  * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
21595  * info.suboffsets = NULL
21596  * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<<
21597  * info.readonly = not PyArray_ISWRITEABLE(self)
21598  *
21599  */
21600  __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
21601 
21602  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":293
21603  * info.suboffsets = NULL
21604  * info.itemsize = PyArray_ITEMSIZE(self)
21605  * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<<
21606  *
21607  * cdef int t
21608  */
21609  __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
21610 
21611  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":296
21612  *
21613  * cdef int t
21614  * cdef char* f = NULL # <<<<<<<<<<<<<<
21615  * cdef dtype descr = <dtype>PyArray_DESCR(self)
21616  * cdef int offset
21617  */
21618  __pyx_v_f = NULL;
21619 
21620  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":297
21621  * cdef int t
21622  * cdef char* f = NULL
21623  * cdef dtype descr = <dtype>PyArray_DESCR(self) # <<<<<<<<<<<<<<
21624  * cdef int offset
21625  *
21626  */
21627  __pyx_t_7 = PyArray_DESCR(__pyx_v_self);
21628  __pyx_t_3 = ((PyObject *)__pyx_t_7);
21629  __Pyx_INCREF(__pyx_t_3);
21630  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
21631  __pyx_t_3 = 0;
21632 
21633  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":300
21634  * cdef int offset
21635  *
21636  * info.obj = self # <<<<<<<<<<<<<<
21637  *
21638  * if not PyDataType_HASFIELDS(descr):
21639  */
21640  __Pyx_INCREF(((PyObject *)__pyx_v_self));
21641  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
21642  __Pyx_GOTREF(__pyx_v_info->obj);
21643  __Pyx_DECREF(__pyx_v_info->obj);
21644  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
21645 
21646  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":302
21647  * info.obj = self
21648  *
21649  * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<<
21650  * t = descr.type_num
21651  * if ((descr.byteorder == c'>' and little_endian) or
21652  */
21653  __pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0);
21654  if (__pyx_t_1) {
21655 
21656  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":303
21657  *
21658  * if not PyDataType_HASFIELDS(descr):
21659  * t = descr.type_num # <<<<<<<<<<<<<<
21660  * if ((descr.byteorder == c'>' and little_endian) or
21661  * (descr.byteorder == c'<' and not little_endian)):
21662  */
21663  __pyx_t_4 = __pyx_v_descr->type_num;
21664  __pyx_v_t = __pyx_t_4;
21665 
21666  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":304
21667  * if not PyDataType_HASFIELDS(descr):
21668  * t = descr.type_num
21669  * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
21670  * (descr.byteorder == c'<' and not little_endian)):
21671  * raise ValueError(u"Non-native byte order not supported")
21672  */
21673  __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
21674  if (!__pyx_t_2) {
21675  goto __pyx_L15_next_or;
21676  } else {
21677  }
21678  __pyx_t_2 = (__pyx_v_little_endian != 0);
21679  if (!__pyx_t_2) {
21680  } else {
21681  __pyx_t_1 = __pyx_t_2;
21682  goto __pyx_L14_bool_binop_done;
21683  }
21684  __pyx_L15_next_or:;
21685 
21686  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":305
21687  * t = descr.type_num
21688  * if ((descr.byteorder == c'>' and little_endian) or
21689  * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
21690  * raise ValueError(u"Non-native byte order not supported")
21691  * if t == NPY_BYTE: f = "b"
21692  */
21693  __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
21694  if (__pyx_t_2) {
21695  } else {
21696  __pyx_t_1 = __pyx_t_2;
21697  goto __pyx_L14_bool_binop_done;
21698  }
21699  __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
21700  __pyx_t_1 = __pyx_t_2;
21701  __pyx_L14_bool_binop_done:;
21702 
21703  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":304
21704  * if not PyDataType_HASFIELDS(descr):
21705  * t = descr.type_num
21706  * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
21707  * (descr.byteorder == c'<' and not little_endian)):
21708  * raise ValueError(u"Non-native byte order not supported")
21709  */
21710  if (unlikely(__pyx_t_1)) {
21711 
21712  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":306
21713  * if ((descr.byteorder == c'>' and little_endian) or
21714  * (descr.byteorder == c'<' and not little_endian)):
21715  * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
21716  * if t == NPY_BYTE: f = "b"
21717  * elif t == NPY_UBYTE: f = "B"
21718  */
21719  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 306, __pyx_L1_error)
21720  __Pyx_GOTREF(__pyx_t_3);
21721  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
21722  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21723  __PYX_ERR(1, 306, __pyx_L1_error)
21724 
21725  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":304
21726  * if not PyDataType_HASFIELDS(descr):
21727  * t = descr.type_num
21728  * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
21729  * (descr.byteorder == c'<' and not little_endian)):
21730  * raise ValueError(u"Non-native byte order not supported")
21731  */
21732  }
21733 
21734  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":307
21735  * (descr.byteorder == c'<' and not little_endian)):
21736  * raise ValueError(u"Non-native byte order not supported")
21737  * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<<
21738  * elif t == NPY_UBYTE: f = "B"
21739  * elif t == NPY_SHORT: f = "h"
21740  */
21741  switch (__pyx_v_t) {
21742  case NPY_BYTE:
21743  __pyx_v_f = ((char *)"b");
21744  break;
21745  case NPY_UBYTE:
21746 
21747  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":308
21748  * raise ValueError(u"Non-native byte order not supported")
21749  * if t == NPY_BYTE: f = "b"
21750  * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<<
21751  * elif t == NPY_SHORT: f = "h"
21752  * elif t == NPY_USHORT: f = "H"
21753  */
21754  __pyx_v_f = ((char *)"B");
21755  break;
21756  case NPY_SHORT:
21757 
21758  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":309
21759  * if t == NPY_BYTE: f = "b"
21760  * elif t == NPY_UBYTE: f = "B"
21761  * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<<
21762  * elif t == NPY_USHORT: f = "H"
21763  * elif t == NPY_INT: f = "i"
21764  */
21765  __pyx_v_f = ((char *)"h");
21766  break;
21767  case NPY_USHORT:
21768 
21769  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":310
21770  * elif t == NPY_UBYTE: f = "B"
21771  * elif t == NPY_SHORT: f = "h"
21772  * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<<
21773  * elif t == NPY_INT: f = "i"
21774  * elif t == NPY_UINT: f = "I"
21775  */
21776  __pyx_v_f = ((char *)"H");
21777  break;
21778  case NPY_INT:
21779 
21780  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":311
21781  * elif t == NPY_SHORT: f = "h"
21782  * elif t == NPY_USHORT: f = "H"
21783  * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<<
21784  * elif t == NPY_UINT: f = "I"
21785  * elif t == NPY_LONG: f = "l"
21786  */
21787  __pyx_v_f = ((char *)"i");
21788  break;
21789  case NPY_UINT:
21790 
21791  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":312
21792  * elif t == NPY_USHORT: f = "H"
21793  * elif t == NPY_INT: f = "i"
21794  * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<<
21795  * elif t == NPY_LONG: f = "l"
21796  * elif t == NPY_ULONG: f = "L"
21797  */
21798  __pyx_v_f = ((char *)"I");
21799  break;
21800  case NPY_LONG:
21801 
21802  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":313
21803  * elif t == NPY_INT: f = "i"
21804  * elif t == NPY_UINT: f = "I"
21805  * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<<
21806  * elif t == NPY_ULONG: f = "L"
21807  * elif t == NPY_LONGLONG: f = "q"
21808  */
21809  __pyx_v_f = ((char *)"l");
21810  break;
21811  case NPY_ULONG:
21812 
21813  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":314
21814  * elif t == NPY_UINT: f = "I"
21815  * elif t == NPY_LONG: f = "l"
21816  * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<<
21817  * elif t == NPY_LONGLONG: f = "q"
21818  * elif t == NPY_ULONGLONG: f = "Q"
21819  */
21820  __pyx_v_f = ((char *)"L");
21821  break;
21822  case NPY_LONGLONG:
21823 
21824  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":315
21825  * elif t == NPY_LONG: f = "l"
21826  * elif t == NPY_ULONG: f = "L"
21827  * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<<
21828  * elif t == NPY_ULONGLONG: f = "Q"
21829  * elif t == NPY_FLOAT: f = "f"
21830  */
21831  __pyx_v_f = ((char *)"q");
21832  break;
21833  case NPY_ULONGLONG:
21834 
21835  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":316
21836  * elif t == NPY_ULONG: f = "L"
21837  * elif t == NPY_LONGLONG: f = "q"
21838  * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<<
21839  * elif t == NPY_FLOAT: f = "f"
21840  * elif t == NPY_DOUBLE: f = "d"
21841  */
21842  __pyx_v_f = ((char *)"Q");
21843  break;
21844  case NPY_FLOAT:
21845 
21846  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":317
21847  * elif t == NPY_LONGLONG: f = "q"
21848  * elif t == NPY_ULONGLONG: f = "Q"
21849  * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<<
21850  * elif t == NPY_DOUBLE: f = "d"
21851  * elif t == NPY_LONGDOUBLE: f = "g"
21852  */
21853  __pyx_v_f = ((char *)"f");
21854  break;
21855  case NPY_DOUBLE:
21856 
21857  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":318
21858  * elif t == NPY_ULONGLONG: f = "Q"
21859  * elif t == NPY_FLOAT: f = "f"
21860  * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<<
21861  * elif t == NPY_LONGDOUBLE: f = "g"
21862  * elif t == NPY_CFLOAT: f = "Zf"
21863  */
21864  __pyx_v_f = ((char *)"d");
21865  break;
21866  case NPY_LONGDOUBLE:
21867 
21868  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":319
21869  * elif t == NPY_FLOAT: f = "f"
21870  * elif t == NPY_DOUBLE: f = "d"
21871  * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<<
21872  * elif t == NPY_CFLOAT: f = "Zf"
21873  * elif t == NPY_CDOUBLE: f = "Zd"
21874  */
21875  __pyx_v_f = ((char *)"g");
21876  break;
21877  case NPY_CFLOAT:
21878 
21879  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":320
21880  * elif t == NPY_DOUBLE: f = "d"
21881  * elif t == NPY_LONGDOUBLE: f = "g"
21882  * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<<
21883  * elif t == NPY_CDOUBLE: f = "Zd"
21884  * elif t == NPY_CLONGDOUBLE: f = "Zg"
21885  */
21886  __pyx_v_f = ((char *)"Zf");
21887  break;
21888  case NPY_CDOUBLE:
21889 
21890  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":321
21891  * elif t == NPY_LONGDOUBLE: f = "g"
21892  * elif t == NPY_CFLOAT: f = "Zf"
21893  * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<<
21894  * elif t == NPY_CLONGDOUBLE: f = "Zg"
21895  * elif t == NPY_OBJECT: f = "O"
21896  */
21897  __pyx_v_f = ((char *)"Zd");
21898  break;
21899  case NPY_CLONGDOUBLE:
21900 
21901  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":322
21902  * elif t == NPY_CFLOAT: f = "Zf"
21903  * elif t == NPY_CDOUBLE: f = "Zd"
21904  * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<<
21905  * elif t == NPY_OBJECT: f = "O"
21906  * else:
21907  */
21908  __pyx_v_f = ((char *)"Zg");
21909  break;
21910  case NPY_OBJECT:
21911 
21912  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":323
21913  * elif t == NPY_CDOUBLE: f = "Zd"
21914  * elif t == NPY_CLONGDOUBLE: f = "Zg"
21915  * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<<
21916  * else:
21917  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
21918  */
21919  __pyx_v_f = ((char *)"O");
21920  break;
21921  default:
21922 
21923  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":325
21924  * elif t == NPY_OBJECT: f = "O"
21925  * else:
21926  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
21927  * info.format = f
21928  * return
21929  */
21930  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error)
21931  __Pyx_GOTREF(__pyx_t_3);
21932  __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 325, __pyx_L1_error)
21933  __Pyx_GOTREF(__pyx_t_8);
21934  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21935  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error)
21936  __Pyx_GOTREF(__pyx_t_3);
21937  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
21938  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
21939  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21940  __PYX_ERR(1, 325, __pyx_L1_error)
21941  break;
21942  }
21943 
21944  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":326
21945  * else:
21946  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
21947  * info.format = f # <<<<<<<<<<<<<<
21948  * return
21949  * else:
21950  */
21951  __pyx_v_info->format = __pyx_v_f;
21952 
21953  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":327
21954  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
21955  * info.format = f
21956  * return # <<<<<<<<<<<<<<
21957  * else:
21958  * info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
21959  */
21960  __pyx_r = 0;
21961  goto __pyx_L0;
21962 
21963  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":302
21964  * info.obj = self
21965  *
21966  * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<<
21967  * t = descr.type_num
21968  * if ((descr.byteorder == c'>' and little_endian) or
21969  */
21970  }
21971 
21972  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":329
21973  * return
21974  * else:
21975  * info.format = <char*>PyObject_Malloc(_buffer_format_string_len) # <<<<<<<<<<<<<<
21976  * info.format[0] = c'^' # Native data types, manual alignment
21977  * offset = 0
21978  */
21979  /*else*/ {
21980  __pyx_v_info->format = ((char *)PyObject_Malloc(0xFF));
21981 
21982  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":330
21983  * else:
21984  * info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
21985  * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<<
21986  * offset = 0
21987  * f = _util_dtypestring(descr, info.format + 1,
21988  */
21989  (__pyx_v_info->format[0]) = '^';
21990 
21991  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":331
21992  * info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
21993  * info.format[0] = c'^' # Native data types, manual alignment
21994  * offset = 0 # <<<<<<<<<<<<<<
21995  * f = _util_dtypestring(descr, info.format + 1,
21996  * info.format + _buffer_format_string_len,
21997  */
21998  __pyx_v_offset = 0;
21999 
22000  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":332
22001  * info.format[0] = c'^' # Native data types, manual alignment
22002  * offset = 0
22003  * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<<
22004  * info.format + _buffer_format_string_len,
22005  * &offset)
22006  */
22007  __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 332, __pyx_L1_error)
22008  __pyx_v_f = __pyx_t_9;
22009 
22010  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":335
22011  * info.format + _buffer_format_string_len,
22012  * &offset)
22013  * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<<
22014  *
22015  * def __releasebuffer__(ndarray self, Py_buffer* info):
22016  */
22017  (__pyx_v_f[0]) = '\x00';
22018  }
22019 
22020  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":258
22021  * # experimental exception made for __getbuffer__ and __releasebuffer__
22022  * # -- the details of this may change.
22023  * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
22024  * # This implementation of getbuffer is geared towards Cython
22025  * # requirements, and does not yet fulfill the PEP.
22026  */
22027 
22028  /* function exit code */
22029  __pyx_r = 0;
22030  goto __pyx_L0;
22031  __pyx_L1_error:;
22032  __Pyx_XDECREF(__pyx_t_3);
22033  __Pyx_XDECREF(__pyx_t_8);
22034  __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
22035  __pyx_r = -1;
22036  if (__pyx_v_info->obj != NULL) {
22037  __Pyx_GOTREF(__pyx_v_info->obj);
22038  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
22039  }
22040  goto __pyx_L2;
22041  __pyx_L0:;
22042  if (__pyx_v_info->obj == Py_None) {
22043  __Pyx_GOTREF(__pyx_v_info->obj);
22044  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
22045  }
22046  __pyx_L2:;
22047  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
22048  __Pyx_RefNannyFinishContext();
22049  return __pyx_r;
22050 }
22051 
22052 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":337
22053  * f[0] = c'\0' # Terminate format string
22054  *
22055  * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
22056  * if PyArray_HASFIELDS(self):
22057  * PyObject_Free(info.format)
22058  */
22059 
22060 /* Python wrapper */
22061 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
22062 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
22063  __Pyx_RefNannyDeclarations
22064  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
22065  __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
22066 
22067  /* function exit code */
22068  __Pyx_RefNannyFinishContext();
22069 }
22070 
22071 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
22072  __Pyx_RefNannyDeclarations
22073  int __pyx_t_1;
22074  __Pyx_RefNannySetupContext("__releasebuffer__", 0);
22075 
22076  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":338
22077  *
22078  * def __releasebuffer__(ndarray self, Py_buffer* info):
22079  * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
22080  * PyObject_Free(info.format)
22081  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
22082  */
22083  __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
22084  if (__pyx_t_1) {
22085 
22086  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":339
22087  * def __releasebuffer__(ndarray self, Py_buffer* info):
22088  * if PyArray_HASFIELDS(self):
22089  * PyObject_Free(info.format) # <<<<<<<<<<<<<<
22090  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
22091  * PyObject_Free(info.strides)
22092  */
22093  PyObject_Free(__pyx_v_info->format);
22094 
22095  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":338
22096  *
22097  * def __releasebuffer__(ndarray self, Py_buffer* info):
22098  * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
22099  * PyObject_Free(info.format)
22100  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
22101  */
22102  }
22103 
22104  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":340
22105  * if PyArray_HASFIELDS(self):
22106  * PyObject_Free(info.format)
22107  * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
22108  * PyObject_Free(info.strides)
22109  * # info.shape was stored after info.strides in the same block
22110  */
22111  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
22112  if (__pyx_t_1) {
22113 
22114  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":341
22115  * PyObject_Free(info.format)
22116  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
22117  * PyObject_Free(info.strides) # <<<<<<<<<<<<<<
22118  * # info.shape was stored after info.strides in the same block
22119  *
22120  */
22121  PyObject_Free(__pyx_v_info->strides);
22122 
22123  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":340
22124  * if PyArray_HASFIELDS(self):
22125  * PyObject_Free(info.format)
22126  * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
22127  * PyObject_Free(info.strides)
22128  * # info.shape was stored after info.strides in the same block
22129  */
22130  }
22131 
22132  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":337
22133  * f[0] = c'\0' # Terminate format string
22134  *
22135  * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
22136  * if PyArray_HASFIELDS(self):
22137  * PyObject_Free(info.format)
22138  */
22139 
22140  /* function exit code */
22141  __Pyx_RefNannyFinishContext();
22142 }
22143 
22144 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":821
22145  * ctypedef npy_cdouble complex_t
22146  *
22147  * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
22148  * return PyArray_MultiIterNew(1, <void*>a)
22149  *
22150  */
22151 
22152 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
22153  PyObject *__pyx_r = NULL;
22154  __Pyx_RefNannyDeclarations
22155  PyObject *__pyx_t_1 = NULL;
22156  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
22157 
22158  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":822
22159  *
22160  * cdef inline object PyArray_MultiIterNew1(a):
22161  * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
22162  *
22163  * cdef inline object PyArray_MultiIterNew2(a, b):
22164  */
22165  __Pyx_XDECREF(__pyx_r);
22166  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 822, __pyx_L1_error)
22167  __Pyx_GOTREF(__pyx_t_1);
22168  __pyx_r = __pyx_t_1;
22169  __pyx_t_1 = 0;
22170  goto __pyx_L0;
22171 
22172  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":821
22173  * ctypedef npy_cdouble complex_t
22174  *
22175  * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
22176  * return PyArray_MultiIterNew(1, <void*>a)
22177  *
22178  */
22179 
22180  /* function exit code */
22181  __pyx_L1_error:;
22182  __Pyx_XDECREF(__pyx_t_1);
22183  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
22184  __pyx_r = 0;
22185  __pyx_L0:;
22186  __Pyx_XGIVEREF(__pyx_r);
22187  __Pyx_RefNannyFinishContext();
22188  return __pyx_r;
22189 }
22190 
22191 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":824
22192  * return PyArray_MultiIterNew(1, <void*>a)
22193  *
22194  * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
22195  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
22196  *
22197  */
22198 
22199 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
22200  PyObject *__pyx_r = NULL;
22201  __Pyx_RefNannyDeclarations
22202  PyObject *__pyx_t_1 = NULL;
22203  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
22204 
22205  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":825
22206  *
22207  * cdef inline object PyArray_MultiIterNew2(a, b):
22208  * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
22209  *
22210  * cdef inline object PyArray_MultiIterNew3(a, b, c):
22211  */
22212  __Pyx_XDECREF(__pyx_r);
22213  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 825, __pyx_L1_error)
22214  __Pyx_GOTREF(__pyx_t_1);
22215  __pyx_r = __pyx_t_1;
22216  __pyx_t_1 = 0;
22217  goto __pyx_L0;
22218 
22219  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":824
22220  * return PyArray_MultiIterNew(1, <void*>a)
22221  *
22222  * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
22223  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
22224  *
22225  */
22226 
22227  /* function exit code */
22228  __pyx_L1_error:;
22229  __Pyx_XDECREF(__pyx_t_1);
22230  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
22231  __pyx_r = 0;
22232  __pyx_L0:;
22233  __Pyx_XGIVEREF(__pyx_r);
22234  __Pyx_RefNannyFinishContext();
22235  return __pyx_r;
22236 }
22237 
22238 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":827
22239  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
22240  *
22241  * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
22242  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
22243  *
22244  */
22245 
22246 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
22247  PyObject *__pyx_r = NULL;
22248  __Pyx_RefNannyDeclarations
22249  PyObject *__pyx_t_1 = NULL;
22250  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
22251 
22252  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":828
22253  *
22254  * cdef inline object PyArray_MultiIterNew3(a, b, c):
22255  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
22256  *
22257  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
22258  */
22259  __Pyx_XDECREF(__pyx_r);
22260  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 828, __pyx_L1_error)
22261  __Pyx_GOTREF(__pyx_t_1);
22262  __pyx_r = __pyx_t_1;
22263  __pyx_t_1 = 0;
22264  goto __pyx_L0;
22265 
22266  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":827
22267  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
22268  *
22269  * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
22270  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
22271  *
22272  */
22273 
22274  /* function exit code */
22275  __pyx_L1_error:;
22276  __Pyx_XDECREF(__pyx_t_1);
22277  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
22278  __pyx_r = 0;
22279  __pyx_L0:;
22280  __Pyx_XGIVEREF(__pyx_r);
22281  __Pyx_RefNannyFinishContext();
22282  return __pyx_r;
22283 }
22284 
22285 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":830
22286  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
22287  *
22288  * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
22289  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
22290  *
22291  */
22292 
22293 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
22294  PyObject *__pyx_r = NULL;
22295  __Pyx_RefNannyDeclarations
22296  PyObject *__pyx_t_1 = NULL;
22297  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
22298 
22299  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":831
22300  *
22301  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
22302  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
22303  *
22304  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
22305  */
22306  __Pyx_XDECREF(__pyx_r);
22307  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 831, __pyx_L1_error)
22308  __Pyx_GOTREF(__pyx_t_1);
22309  __pyx_r = __pyx_t_1;
22310  __pyx_t_1 = 0;
22311  goto __pyx_L0;
22312 
22313  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":830
22314  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
22315  *
22316  * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
22317  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
22318  *
22319  */
22320 
22321  /* function exit code */
22322  __pyx_L1_error:;
22323  __Pyx_XDECREF(__pyx_t_1);
22324  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
22325  __pyx_r = 0;
22326  __pyx_L0:;
22327  __Pyx_XGIVEREF(__pyx_r);
22328  __Pyx_RefNannyFinishContext();
22329  return __pyx_r;
22330 }
22331 
22332 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":833
22333  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
22334  *
22335  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
22336  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
22337  *
22338  */
22339 
22340 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
22341  PyObject *__pyx_r = NULL;
22342  __Pyx_RefNannyDeclarations
22343  PyObject *__pyx_t_1 = NULL;
22344  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
22345 
22346  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":834
22347  *
22348  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
22349  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
22350  *
22351  * cdef inline tuple PyDataType_SHAPE(dtype d):
22352  */
22353  __Pyx_XDECREF(__pyx_r);
22354  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 834, __pyx_L1_error)
22355  __Pyx_GOTREF(__pyx_t_1);
22356  __pyx_r = __pyx_t_1;
22357  __pyx_t_1 = 0;
22358  goto __pyx_L0;
22359 
22360  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":833
22361  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
22362  *
22363  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
22364  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
22365  *
22366  */
22367 
22368  /* function exit code */
22369  __pyx_L1_error:;
22370  __Pyx_XDECREF(__pyx_t_1);
22371  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
22372  __pyx_r = 0;
22373  __pyx_L0:;
22374  __Pyx_XGIVEREF(__pyx_r);
22375  __Pyx_RefNannyFinishContext();
22376  return __pyx_r;
22377 }
22378 
22379 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":836
22380  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
22381  *
22382  * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
22383  * if PyDataType_HASSUBARRAY(d):
22384  * return <tuple>d.subarray.shape
22385  */
22386 
22387 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
22388  PyObject *__pyx_r = NULL;
22389  __Pyx_RefNannyDeclarations
22390  int __pyx_t_1;
22391  __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
22392 
22393  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":837
22394  *
22395  * cdef inline tuple PyDataType_SHAPE(dtype d):
22396  * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
22397  * return <tuple>d.subarray.shape
22398  * else:
22399  */
22400  __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
22401  if (__pyx_t_1) {
22402 
22403  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":838
22404  * cdef inline tuple PyDataType_SHAPE(dtype d):
22405  * if PyDataType_HASSUBARRAY(d):
22406  * return <tuple>d.subarray.shape # <<<<<<<<<<<<<<
22407  * else:
22408  * return ()
22409  */
22410  __Pyx_XDECREF(__pyx_r);
22411  __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
22412  __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
22413  goto __pyx_L0;
22414 
22415  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":837
22416  *
22417  * cdef inline tuple PyDataType_SHAPE(dtype d):
22418  * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
22419  * return <tuple>d.subarray.shape
22420  * else:
22421  */
22422  }
22423 
22424  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":840
22425  * return <tuple>d.subarray.shape
22426  * else:
22427  * return () # <<<<<<<<<<<<<<
22428  *
22429  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
22430  */
22431  /*else*/ {
22432  __Pyx_XDECREF(__pyx_r);
22433  __Pyx_INCREF(__pyx_empty_tuple);
22434  __pyx_r = __pyx_empty_tuple;
22435  goto __pyx_L0;
22436  }
22437 
22438  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":836
22439  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
22440  *
22441  * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
22442  * if PyDataType_HASSUBARRAY(d):
22443  * return <tuple>d.subarray.shape
22444  */
22445 
22446  /* function exit code */
22447  __pyx_L0:;
22448  __Pyx_XGIVEREF(__pyx_r);
22449  __Pyx_RefNannyFinishContext();
22450  return __pyx_r;
22451 }
22452 
22453 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":842
22454  * return ()
22455  *
22456  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
22457  * # Recursive utility function used in __getbuffer__ to get format
22458  * # string. The new location in the format string is returned.
22459  */
22460 
22461 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
22462  PyArray_Descr *__pyx_v_child = 0;
22463  int __pyx_v_endian_detector;
22464  int __pyx_v_little_endian;
22465  PyObject *__pyx_v_fields = 0;
22466  PyObject *__pyx_v_childname = NULL;
22467  PyObject *__pyx_v_new_offset = NULL;
22468  PyObject *__pyx_v_t = NULL;
22469  char *__pyx_r;
22470  __Pyx_RefNannyDeclarations
22471  PyObject *__pyx_t_1 = NULL;
22472  Py_ssize_t __pyx_t_2;
22473  PyObject *__pyx_t_3 = NULL;
22474  PyObject *__pyx_t_4 = NULL;
22475  int __pyx_t_5;
22476  int __pyx_t_6;
22477  int __pyx_t_7;
22478  long __pyx_t_8;
22479  char *__pyx_t_9;
22480  __Pyx_RefNannySetupContext("_util_dtypestring", 0);
22481 
22482  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":847
22483  *
22484  * cdef dtype child
22485  * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
22486  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
22487  * cdef tuple fields
22488  */
22489  __pyx_v_endian_detector = 1;
22490 
22491  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":848
22492  * cdef dtype child
22493  * cdef int endian_detector = 1
22494  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
22495  * cdef tuple fields
22496  *
22497  */
22498  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
22499 
22500  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":851
22501  * cdef tuple fields
22502  *
22503  * for childname in descr.names: # <<<<<<<<<<<<<<
22504  * fields = descr.fields[childname]
22505  * child, new_offset = fields
22506  */
22507  if (unlikely(__pyx_v_descr->names == Py_None)) {
22508  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
22509  __PYX_ERR(1, 851, __pyx_L1_error)
22510  }
22511  __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
22512  for (;;) {
22513  if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
22514  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
22515  __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 851, __pyx_L1_error)
22516  #else
22517  __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 851, __pyx_L1_error)
22518  __Pyx_GOTREF(__pyx_t_3);
22519  #endif
22520  __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
22521  __pyx_t_3 = 0;
22522 
22523  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":852
22524  *
22525  * for childname in descr.names:
22526  * fields = descr.fields[childname] # <<<<<<<<<<<<<<
22527  * child, new_offset = fields
22528  *
22529  */
22530  if (unlikely(__pyx_v_descr->fields == Py_None)) {
22531  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
22532  __PYX_ERR(1, 852, __pyx_L1_error)
22533  }
22534  __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 852, __pyx_L1_error)
22535  __Pyx_GOTREF(__pyx_t_3);
22536  if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 852, __pyx_L1_error)
22537  __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
22538  __pyx_t_3 = 0;
22539 
22540  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":853
22541  * for childname in descr.names:
22542  * fields = descr.fields[childname]
22543  * child, new_offset = fields # <<<<<<<<<<<<<<
22544  *
22545  * if (end - f) - <int>(new_offset - offset[0]) < 15:
22546  */
22547  if (likely(__pyx_v_fields != Py_None)) {
22548  PyObject* sequence = __pyx_v_fields;
22549  Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
22550  if (unlikely(size != 2)) {
22551  if (size > 2) __Pyx_RaiseTooManyValuesError(2);
22552  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
22553  __PYX_ERR(1, 853, __pyx_L1_error)
22554  }
22555  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
22556  __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
22557  __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
22558  __Pyx_INCREF(__pyx_t_3);
22559  __Pyx_INCREF(__pyx_t_4);
22560  #else
22561  __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 853, __pyx_L1_error)
22562  __Pyx_GOTREF(__pyx_t_3);
22563  __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 853, __pyx_L1_error)
22564  __Pyx_GOTREF(__pyx_t_4);
22565  #endif
22566  } else {
22567  __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 853, __pyx_L1_error)
22568  }
22569  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 853, __pyx_L1_error)
22570  __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
22571  __pyx_t_3 = 0;
22572  __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
22573  __pyx_t_4 = 0;
22574 
22575  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":855
22576  * child, new_offset = fields
22577  *
22578  * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
22579  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
22580  *
22581  */
22582  __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 855, __pyx_L1_error)
22583  __Pyx_GOTREF(__pyx_t_4);
22584  __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 855, __pyx_L1_error)
22585  __Pyx_GOTREF(__pyx_t_3);
22586  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22587  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 855, __pyx_L1_error)
22588  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22589  __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
22590  if (unlikely(__pyx_t_6)) {
22591 
22592  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":856
22593  *
22594  * if (end - f) - <int>(new_offset - offset[0]) < 15:
22595  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
22596  *
22597  * if ((child.byteorder == c'>' and little_endian) or
22598  */
22599  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 856, __pyx_L1_error)
22600  __Pyx_GOTREF(__pyx_t_3);
22601  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
22602  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22603  __PYX_ERR(1, 856, __pyx_L1_error)
22604 
22605  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":855
22606  * child, new_offset = fields
22607  *
22608  * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
22609  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
22610  *
22611  */
22612  }
22613 
22614  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":858
22615  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
22616  *
22617  * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
22618  * (child.byteorder == c'<' and not little_endian)):
22619  * raise ValueError(u"Non-native byte order not supported")
22620  */
22621  __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
22622  if (!__pyx_t_7) {
22623  goto __pyx_L8_next_or;
22624  } else {
22625  }
22626  __pyx_t_7 = (__pyx_v_little_endian != 0);
22627  if (!__pyx_t_7) {
22628  } else {
22629  __pyx_t_6 = __pyx_t_7;
22630  goto __pyx_L7_bool_binop_done;
22631  }
22632  __pyx_L8_next_or:;
22633 
22634  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":859
22635  *
22636  * if ((child.byteorder == c'>' and little_endian) or
22637  * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
22638  * raise ValueError(u"Non-native byte order not supported")
22639  * # One could encode it in the format string and have Cython
22640  */
22641  __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
22642  if (__pyx_t_7) {
22643  } else {
22644  __pyx_t_6 = __pyx_t_7;
22645  goto __pyx_L7_bool_binop_done;
22646  }
22647  __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
22648  __pyx_t_6 = __pyx_t_7;
22649  __pyx_L7_bool_binop_done:;
22650 
22651  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":858
22652  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
22653  *
22654  * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
22655  * (child.byteorder == c'<' and not little_endian)):
22656  * raise ValueError(u"Non-native byte order not supported")
22657  */
22658  if (unlikely(__pyx_t_6)) {
22659 
22660  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":860
22661  * if ((child.byteorder == c'>' and little_endian) or
22662  * (child.byteorder == c'<' and not little_endian)):
22663  * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
22664  * # One could encode it in the format string and have Cython
22665  * # complain instead, BUT: < and > in format strings also imply
22666  */
22667  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 860, __pyx_L1_error)
22668  __Pyx_GOTREF(__pyx_t_3);
22669  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
22670  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22671  __PYX_ERR(1, 860, __pyx_L1_error)
22672 
22673  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":858
22674  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
22675  *
22676  * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
22677  * (child.byteorder == c'<' and not little_endian)):
22678  * raise ValueError(u"Non-native byte order not supported")
22679  */
22680  }
22681 
22682  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":870
22683  *
22684  * # Output padding bytes
22685  * while offset[0] < new_offset: # <<<<<<<<<<<<<<
22686  * f[0] = 120 # "x"; pad byte
22687  * f += 1
22688  */
22689  while (1) {
22690  __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 870, __pyx_L1_error)
22691  __Pyx_GOTREF(__pyx_t_3);
22692  __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 870, __pyx_L1_error)
22693  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22694  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 870, __pyx_L1_error)
22695  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22696  if (!__pyx_t_6) break;
22697 
22698  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":871
22699  * # Output padding bytes
22700  * while offset[0] < new_offset:
22701  * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<<
22702  * f += 1
22703  * offset[0] += 1
22704  */
22705  (__pyx_v_f[0]) = 0x78;
22706 
22707  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":872
22708  * while offset[0] < new_offset:
22709  * f[0] = 120 # "x"; pad byte
22710  * f += 1 # <<<<<<<<<<<<<<
22711  * offset[0] += 1
22712  *
22713  */
22714  __pyx_v_f = (__pyx_v_f + 1);
22715 
22716  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":873
22717  * f[0] = 120 # "x"; pad byte
22718  * f += 1
22719  * offset[0] += 1 # <<<<<<<<<<<<<<
22720  *
22721  * offset[0] += child.itemsize
22722  */
22723  __pyx_t_8 = 0;
22724  (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
22725  }
22726 
22727  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":875
22728  * offset[0] += 1
22729  *
22730  * offset[0] += child.itemsize # <<<<<<<<<<<<<<
22731  *
22732  * if not PyDataType_HASFIELDS(child):
22733  */
22734  __pyx_t_8 = 0;
22735  (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
22736 
22737  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":877
22738  * offset[0] += child.itemsize
22739  *
22740  * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
22741  * t = child.type_num
22742  * if end - f < 5:
22743  */
22744  __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
22745  if (__pyx_t_6) {
22746 
22747  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":878
22748  *
22749  * if not PyDataType_HASFIELDS(child):
22750  * t = child.type_num # <<<<<<<<<<<<<<
22751  * if end - f < 5:
22752  * raise RuntimeError(u"Format string allocated too short.")
22753  */
22754  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 878, __pyx_L1_error)
22755  __Pyx_GOTREF(__pyx_t_4);
22756  __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
22757  __pyx_t_4 = 0;
22758 
22759  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":879
22760  * if not PyDataType_HASFIELDS(child):
22761  * t = child.type_num
22762  * if end - f < 5: # <<<<<<<<<<<<<<
22763  * raise RuntimeError(u"Format string allocated too short.")
22764  *
22765  */
22766  __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
22767  if (unlikely(__pyx_t_6)) {
22768 
22769  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":880
22770  * t = child.type_num
22771  * if end - f < 5:
22772  * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
22773  *
22774  * # Until ticket #99 is fixed, use integers to avoid warnings
22775  */
22776  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 880, __pyx_L1_error)
22777  __Pyx_GOTREF(__pyx_t_4);
22778  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
22779  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22780  __PYX_ERR(1, 880, __pyx_L1_error)
22781 
22782  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":879
22783  * if not PyDataType_HASFIELDS(child):
22784  * t = child.type_num
22785  * if end - f < 5: # <<<<<<<<<<<<<<
22786  * raise RuntimeError(u"Format string allocated too short.")
22787  *
22788  */
22789  }
22790 
22791  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":883
22792  *
22793  * # Until ticket #99 is fixed, use integers to avoid warnings
22794  * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<<
22795  * elif t == NPY_UBYTE: f[0] = 66 #"B"
22796  * elif t == NPY_SHORT: f[0] = 104 #"h"
22797  */
22798  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 883, __pyx_L1_error)
22799  __Pyx_GOTREF(__pyx_t_4);
22800  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 883, __pyx_L1_error)
22801  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22802  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 883, __pyx_L1_error)
22803  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22804  if (__pyx_t_6) {
22805  (__pyx_v_f[0]) = 98;
22806  goto __pyx_L15;
22807  }
22808 
22809  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":884
22810  * # Until ticket #99 is fixed, use integers to avoid warnings
22811  * if t == NPY_BYTE: f[0] = 98 #"b"
22812  * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<<
22813  * elif t == NPY_SHORT: f[0] = 104 #"h"
22814  * elif t == NPY_USHORT: f[0] = 72 #"H"
22815  */
22816  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 884, __pyx_L1_error)
22817  __Pyx_GOTREF(__pyx_t_3);
22818  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 884, __pyx_L1_error)
22819  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22820  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 884, __pyx_L1_error)
22821  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22822  if (__pyx_t_6) {
22823  (__pyx_v_f[0]) = 66;
22824  goto __pyx_L15;
22825  }
22826 
22827  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":885
22828  * if t == NPY_BYTE: f[0] = 98 #"b"
22829  * elif t == NPY_UBYTE: f[0] = 66 #"B"
22830  * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<<
22831  * elif t == NPY_USHORT: f[0] = 72 #"H"
22832  * elif t == NPY_INT: f[0] = 105 #"i"
22833  */
22834  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 885, __pyx_L1_error)
22835  __Pyx_GOTREF(__pyx_t_4);
22836  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 885, __pyx_L1_error)
22837  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22838  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 885, __pyx_L1_error)
22839  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22840  if (__pyx_t_6) {
22841  (__pyx_v_f[0]) = 0x68;
22842  goto __pyx_L15;
22843  }
22844 
22845  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":886
22846  * elif t == NPY_UBYTE: f[0] = 66 #"B"
22847  * elif t == NPY_SHORT: f[0] = 104 #"h"
22848  * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<<
22849  * elif t == NPY_INT: f[0] = 105 #"i"
22850  * elif t == NPY_UINT: f[0] = 73 #"I"
22851  */
22852  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 886, __pyx_L1_error)
22853  __Pyx_GOTREF(__pyx_t_3);
22854  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 886, __pyx_L1_error)
22855  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22856  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 886, __pyx_L1_error)
22857  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22858  if (__pyx_t_6) {
22859  (__pyx_v_f[0]) = 72;
22860  goto __pyx_L15;
22861  }
22862 
22863  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":887
22864  * elif t == NPY_SHORT: f[0] = 104 #"h"
22865  * elif t == NPY_USHORT: f[0] = 72 #"H"
22866  * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<<
22867  * elif t == NPY_UINT: f[0] = 73 #"I"
22868  * elif t == NPY_LONG: f[0] = 108 #"l"
22869  */
22870  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 887, __pyx_L1_error)
22871  __Pyx_GOTREF(__pyx_t_4);
22872  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 887, __pyx_L1_error)
22873  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22874  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 887, __pyx_L1_error)
22875  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22876  if (__pyx_t_6) {
22877  (__pyx_v_f[0]) = 0x69;
22878  goto __pyx_L15;
22879  }
22880 
22881  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":888
22882  * elif t == NPY_USHORT: f[0] = 72 #"H"
22883  * elif t == NPY_INT: f[0] = 105 #"i"
22884  * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<<
22885  * elif t == NPY_LONG: f[0] = 108 #"l"
22886  * elif t == NPY_ULONG: f[0] = 76 #"L"
22887  */
22888  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 888, __pyx_L1_error)
22889  __Pyx_GOTREF(__pyx_t_3);
22890  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 888, __pyx_L1_error)
22891  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22892  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 888, __pyx_L1_error)
22893  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22894  if (__pyx_t_6) {
22895  (__pyx_v_f[0]) = 73;
22896  goto __pyx_L15;
22897  }
22898 
22899  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":889
22900  * elif t == NPY_INT: f[0] = 105 #"i"
22901  * elif t == NPY_UINT: f[0] = 73 #"I"
22902  * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<<
22903  * elif t == NPY_ULONG: f[0] = 76 #"L"
22904  * elif t == NPY_LONGLONG: f[0] = 113 #"q"
22905  */
22906  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 889, __pyx_L1_error)
22907  __Pyx_GOTREF(__pyx_t_4);
22908  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 889, __pyx_L1_error)
22909  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22910  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 889, __pyx_L1_error)
22911  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22912  if (__pyx_t_6) {
22913  (__pyx_v_f[0]) = 0x6C;
22914  goto __pyx_L15;
22915  }
22916 
22917  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":890
22918  * elif t == NPY_UINT: f[0] = 73 #"I"
22919  * elif t == NPY_LONG: f[0] = 108 #"l"
22920  * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<<
22921  * elif t == NPY_LONGLONG: f[0] = 113 #"q"
22922  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
22923  */
22924  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 890, __pyx_L1_error)
22925  __Pyx_GOTREF(__pyx_t_3);
22926  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 890, __pyx_L1_error)
22927  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22928  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 890, __pyx_L1_error)
22929  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22930  if (__pyx_t_6) {
22931  (__pyx_v_f[0]) = 76;
22932  goto __pyx_L15;
22933  }
22934 
22935  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":891
22936  * elif t == NPY_LONG: f[0] = 108 #"l"
22937  * elif t == NPY_ULONG: f[0] = 76 #"L"
22938  * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<<
22939  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
22940  * elif t == NPY_FLOAT: f[0] = 102 #"f"
22941  */
22942  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 891, __pyx_L1_error)
22943  __Pyx_GOTREF(__pyx_t_4);
22944  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 891, __pyx_L1_error)
22945  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22946  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 891, __pyx_L1_error)
22947  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22948  if (__pyx_t_6) {
22949  (__pyx_v_f[0]) = 0x71;
22950  goto __pyx_L15;
22951  }
22952 
22953  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":892
22954  * elif t == NPY_ULONG: f[0] = 76 #"L"
22955  * elif t == NPY_LONGLONG: f[0] = 113 #"q"
22956  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<<
22957  * elif t == NPY_FLOAT: f[0] = 102 #"f"
22958  * elif t == NPY_DOUBLE: f[0] = 100 #"d"
22959  */
22960  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 892, __pyx_L1_error)
22961  __Pyx_GOTREF(__pyx_t_3);
22962  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 892, __pyx_L1_error)
22963  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22964  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 892, __pyx_L1_error)
22965  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22966  if (__pyx_t_6) {
22967  (__pyx_v_f[0]) = 81;
22968  goto __pyx_L15;
22969  }
22970 
22971  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":893
22972  * elif t == NPY_LONGLONG: f[0] = 113 #"q"
22973  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
22974  * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<<
22975  * elif t == NPY_DOUBLE: f[0] = 100 #"d"
22976  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
22977  */
22978  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 893, __pyx_L1_error)
22979  __Pyx_GOTREF(__pyx_t_4);
22980  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 893, __pyx_L1_error)
22981  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22982  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 893, __pyx_L1_error)
22983  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22984  if (__pyx_t_6) {
22985  (__pyx_v_f[0]) = 0x66;
22986  goto __pyx_L15;
22987  }
22988 
22989  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":894
22990  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
22991  * elif t == NPY_FLOAT: f[0] = 102 #"f"
22992  * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<<
22993  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
22994  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
22995  */
22996  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 894, __pyx_L1_error)
22997  __Pyx_GOTREF(__pyx_t_3);
22998  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 894, __pyx_L1_error)
22999  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23000  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 894, __pyx_L1_error)
23001  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23002  if (__pyx_t_6) {
23003  (__pyx_v_f[0]) = 0x64;
23004  goto __pyx_L15;
23005  }
23006 
23007  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":895
23008  * elif t == NPY_FLOAT: f[0] = 102 #"f"
23009  * elif t == NPY_DOUBLE: f[0] = 100 #"d"
23010  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<<
23011  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
23012  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
23013  */
23014  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 895, __pyx_L1_error)
23015  __Pyx_GOTREF(__pyx_t_4);
23016  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 895, __pyx_L1_error)
23017  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23018  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 895, __pyx_L1_error)
23019  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23020  if (__pyx_t_6) {
23021  (__pyx_v_f[0]) = 0x67;
23022  goto __pyx_L15;
23023  }
23024 
23025  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":896
23026  * elif t == NPY_DOUBLE: f[0] = 100 #"d"
23027  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
23028  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<<
23029  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
23030  * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
23031  */
23032  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 896, __pyx_L1_error)
23033  __Pyx_GOTREF(__pyx_t_3);
23034  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 896, __pyx_L1_error)
23035  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23036  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 896, __pyx_L1_error)
23037  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23038  if (__pyx_t_6) {
23039  (__pyx_v_f[0]) = 90;
23040  (__pyx_v_f[1]) = 0x66;
23041  __pyx_v_f = (__pyx_v_f + 1);
23042  goto __pyx_L15;
23043  }
23044 
23045  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":897
23046  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
23047  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
23048  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<<
23049  * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
23050  * elif t == NPY_OBJECT: f[0] = 79 #"O"
23051  */
23052  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 897, __pyx_L1_error)
23053  __Pyx_GOTREF(__pyx_t_4);
23054  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 897, __pyx_L1_error)
23055  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23056  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 897, __pyx_L1_error)
23057  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23058  if (__pyx_t_6) {
23059  (__pyx_v_f[0]) = 90;
23060  (__pyx_v_f[1]) = 0x64;
23061  __pyx_v_f = (__pyx_v_f + 1);
23062  goto __pyx_L15;
23063  }
23064 
23065  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":898
23066  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
23067  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
23068  * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<<
23069  * elif t == NPY_OBJECT: f[0] = 79 #"O"
23070  * else:
23071  */
23072  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 898, __pyx_L1_error)
23073  __Pyx_GOTREF(__pyx_t_3);
23074  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 898, __pyx_L1_error)
23075  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23076  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 898, __pyx_L1_error)
23077  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23078  if (__pyx_t_6) {
23079  (__pyx_v_f[0]) = 90;
23080  (__pyx_v_f[1]) = 0x67;
23081  __pyx_v_f = (__pyx_v_f + 1);
23082  goto __pyx_L15;
23083  }
23084 
23085  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":899
23086  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
23087  * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
23088  * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<<
23089  * else:
23090  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
23091  */
23092  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 899, __pyx_L1_error)
23093  __Pyx_GOTREF(__pyx_t_4);
23094  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 899, __pyx_L1_error)
23095  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23096  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 899, __pyx_L1_error)
23097  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23098  if (likely(__pyx_t_6)) {
23099  (__pyx_v_f[0]) = 79;
23100  goto __pyx_L15;
23101  }
23102 
23103  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":901
23104  * elif t == NPY_OBJECT: f[0] = 79 #"O"
23105  * else:
23106  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
23107  * f += 1
23108  * else:
23109  */
23110  /*else*/ {
23111  __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 901, __pyx_L1_error)
23112  __Pyx_GOTREF(__pyx_t_3);
23113  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 901, __pyx_L1_error)
23114  __Pyx_GOTREF(__pyx_t_4);
23115  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23116  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
23117  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23118  __PYX_ERR(1, 901, __pyx_L1_error)
23119  }
23120  __pyx_L15:;
23121 
23122  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":902
23123  * else:
23124  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
23125  * f += 1 # <<<<<<<<<<<<<<
23126  * else:
23127  * # Cython ignores struct boundary information ("T{...}"),
23128  */
23129  __pyx_v_f = (__pyx_v_f + 1);
23130 
23131  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":877
23132  * offset[0] += child.itemsize
23133  *
23134  * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
23135  * t = child.type_num
23136  * if end - f < 5:
23137  */
23138  goto __pyx_L13;
23139  }
23140 
23141  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":906
23142  * # Cython ignores struct boundary information ("T{...}"),
23143  * # so don't output it
23144  * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<<
23145  * return f
23146  *
23147  */
23148  /*else*/ {
23149  __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 906, __pyx_L1_error)
23150  __pyx_v_f = __pyx_t_9;
23151  }
23152  __pyx_L13:;
23153 
23154  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":851
23155  * cdef tuple fields
23156  *
23157  * for childname in descr.names: # <<<<<<<<<<<<<<
23158  * fields = descr.fields[childname]
23159  * child, new_offset = fields
23160  */
23161  }
23162  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23163 
23164  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":907
23165  * # so don't output it
23166  * f = _util_dtypestring(child, f, end, offset)
23167  * return f # <<<<<<<<<<<<<<
23168  *
23169  *
23170  */
23171  __pyx_r = __pyx_v_f;
23172  goto __pyx_L0;
23173 
23174  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":842
23175  * return ()
23176  *
23177  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
23178  * # Recursive utility function used in __getbuffer__ to get format
23179  * # string. The new location in the format string is returned.
23180  */
23181 
23182  /* function exit code */
23183  __pyx_L1_error:;
23184  __Pyx_XDECREF(__pyx_t_1);
23185  __Pyx_XDECREF(__pyx_t_3);
23186  __Pyx_XDECREF(__pyx_t_4);
23187  __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
23188  __pyx_r = NULL;
23189  __pyx_L0:;
23190  __Pyx_XDECREF((PyObject *)__pyx_v_child);
23191  __Pyx_XDECREF(__pyx_v_fields);
23192  __Pyx_XDECREF(__pyx_v_childname);
23193  __Pyx_XDECREF(__pyx_v_new_offset);
23194  __Pyx_XDECREF(__pyx_v_t);
23195  __Pyx_RefNannyFinishContext();
23196  return __pyx_r;
23197 }
23198 
23199 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1022
23200  * int _import_umath() except -1
23201  *
23202  * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
23203  * Py_INCREF(base) # important to do this before stealing the reference below!
23204  * PyArray_SetBaseObject(arr, base)
23205  */
23206 
23207 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
23208  __Pyx_RefNannyDeclarations
23209  __Pyx_RefNannySetupContext("set_array_base", 0);
23210 
23211  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1023
23212  *
23213  * cdef inline void set_array_base(ndarray arr, object base):
23214  * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<<
23215  * PyArray_SetBaseObject(arr, base)
23216  *
23217  */
23218  Py_INCREF(__pyx_v_base);
23219 
23220  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1024
23221  * cdef inline void set_array_base(ndarray arr, object base):
23222  * Py_INCREF(base) # important to do this before stealing the reference below!
23223  * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<<
23224  *
23225  * cdef inline object get_array_base(ndarray arr):
23226  */
23227  (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
23228 
23229  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1022
23230  * int _import_umath() except -1
23231  *
23232  * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
23233  * Py_INCREF(base) # important to do this before stealing the reference below!
23234  * PyArray_SetBaseObject(arr, base)
23235  */
23236 
23237  /* function exit code */
23238  __Pyx_RefNannyFinishContext();
23239 }
23240 
23241 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1026
23242  * PyArray_SetBaseObject(arr, base)
23243  *
23244  * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
23245  * base = PyArray_BASE(arr)
23246  * if base is NULL:
23247  */
23248 
23249 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
23250  PyObject *__pyx_v_base;
23251  PyObject *__pyx_r = NULL;
23252  __Pyx_RefNannyDeclarations
23253  int __pyx_t_1;
23254  __Pyx_RefNannySetupContext("get_array_base", 0);
23255 
23256  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1027
23257  *
23258  * cdef inline object get_array_base(ndarray arr):
23259  * base = PyArray_BASE(arr) # <<<<<<<<<<<<<<
23260  * if base is NULL:
23261  * return None
23262  */
23263  __pyx_v_base = PyArray_BASE(__pyx_v_arr);
23264 
23265  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1028
23266  * cdef inline object get_array_base(ndarray arr):
23267  * base = PyArray_BASE(arr)
23268  * if base is NULL: # <<<<<<<<<<<<<<
23269  * return None
23270  * return <object>base
23271  */
23272  __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
23273  if (__pyx_t_1) {
23274 
23275  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1029
23276  * base = PyArray_BASE(arr)
23277  * if base is NULL:
23278  * return None # <<<<<<<<<<<<<<
23279  * return <object>base
23280  *
23281  */
23282  __Pyx_XDECREF(__pyx_r);
23283  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
23284  goto __pyx_L0;
23285 
23286  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1028
23287  * cdef inline object get_array_base(ndarray arr):
23288  * base = PyArray_BASE(arr)
23289  * if base is NULL: # <<<<<<<<<<<<<<
23290  * return None
23291  * return <object>base
23292  */
23293  }
23294 
23295  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1030
23296  * if base is NULL:
23297  * return None
23298  * return <object>base # <<<<<<<<<<<<<<
23299  *
23300  * # Versions of the import_* functions which are more suitable for
23301  */
23302  __Pyx_XDECREF(__pyx_r);
23303  __Pyx_INCREF(((PyObject *)__pyx_v_base));
23304  __pyx_r = ((PyObject *)__pyx_v_base);
23305  goto __pyx_L0;
23306 
23307  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1026
23308  * PyArray_SetBaseObject(arr, base)
23309  *
23310  * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
23311  * base = PyArray_BASE(arr)
23312  * if base is NULL:
23313  */
23314 
23315  /* function exit code */
23316  __pyx_L0:;
23317  __Pyx_XGIVEREF(__pyx_r);
23318  __Pyx_RefNannyFinishContext();
23319  return __pyx_r;
23320 }
23321 
23322 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1034
23323  * # Versions of the import_* functions which are more suitable for
23324  * # Cython code.
23325  * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
23326  * try:
23327  * _import_array()
23328  */
23329 
23330 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
23331  int __pyx_r;
23332  __Pyx_RefNannyDeclarations
23333  PyObject *__pyx_t_1 = NULL;
23334  PyObject *__pyx_t_2 = NULL;
23335  PyObject *__pyx_t_3 = NULL;
23336  int __pyx_t_4;
23337  PyObject *__pyx_t_5 = NULL;
23338  PyObject *__pyx_t_6 = NULL;
23339  PyObject *__pyx_t_7 = NULL;
23340  PyObject *__pyx_t_8 = NULL;
23341  __Pyx_RefNannySetupContext("import_array", 0);
23342 
23343  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1035
23344  * # Cython code.
23345  * cdef inline int import_array() except -1:
23346  * try: # <<<<<<<<<<<<<<
23347  * _import_array()
23348  * except Exception:
23349  */
23350  {
23351  __Pyx_PyThreadState_declare
23352  __Pyx_PyThreadState_assign
23353  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
23354  __Pyx_XGOTREF(__pyx_t_1);
23355  __Pyx_XGOTREF(__pyx_t_2);
23356  __Pyx_XGOTREF(__pyx_t_3);
23357  /*try:*/ {
23358 
23359  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1036
23360  * cdef inline int import_array() except -1:
23361  * try:
23362  * _import_array() # <<<<<<<<<<<<<<
23363  * except Exception:
23364  * raise ImportError("numpy.core.multiarray failed to import")
23365  */
23366  __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1036, __pyx_L3_error)
23367 
23368  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1035
23369  * # Cython code.
23370  * cdef inline int import_array() except -1:
23371  * try: # <<<<<<<<<<<<<<
23372  * _import_array()
23373  * except Exception:
23374  */
23375  }
23376  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
23377  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
23378  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
23379  goto __pyx_L8_try_end;
23380  __pyx_L3_error:;
23381 
23382  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1037
23383  * try:
23384  * _import_array()
23385  * except Exception: # <<<<<<<<<<<<<<
23386  * raise ImportError("numpy.core.multiarray failed to import")
23387  *
23388  */
23389  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
23390  if (__pyx_t_4) {
23391  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
23392  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1037, __pyx_L5_except_error)
23393  __Pyx_GOTREF(__pyx_t_5);
23394  __Pyx_GOTREF(__pyx_t_6);
23395  __Pyx_GOTREF(__pyx_t_7);
23396 
23397  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1038
23398  * _import_array()
23399  * except Exception:
23400  * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
23401  *
23402  * cdef inline int import_umath() except -1:
23403  */
23404  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1038, __pyx_L5_except_error)
23405  __Pyx_GOTREF(__pyx_t_8);
23406  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
23407  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
23408  __PYX_ERR(1, 1038, __pyx_L5_except_error)
23409  }
23410  goto __pyx_L5_except_error;
23411  __pyx_L5_except_error:;
23412 
23413  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1035
23414  * # Cython code.
23415  * cdef inline int import_array() except -1:
23416  * try: # <<<<<<<<<<<<<<
23417  * _import_array()
23418  * except Exception:
23419  */
23420  __Pyx_XGIVEREF(__pyx_t_1);
23421  __Pyx_XGIVEREF(__pyx_t_2);
23422  __Pyx_XGIVEREF(__pyx_t_3);
23423  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
23424  goto __pyx_L1_error;
23425  __pyx_L8_try_end:;
23426  }
23427 
23428  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1034
23429  * # Versions of the import_* functions which are more suitable for
23430  * # Cython code.
23431  * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
23432  * try:
23433  * _import_array()
23434  */
23435 
23436  /* function exit code */
23437  __pyx_r = 0;
23438  goto __pyx_L0;
23439  __pyx_L1_error:;
23440  __Pyx_XDECREF(__pyx_t_5);
23441  __Pyx_XDECREF(__pyx_t_6);
23442  __Pyx_XDECREF(__pyx_t_7);
23443  __Pyx_XDECREF(__pyx_t_8);
23444  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
23445  __pyx_r = -1;
23446  __pyx_L0:;
23447  __Pyx_RefNannyFinishContext();
23448  return __pyx_r;
23449 }
23450 
23451 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1040
23452  * raise ImportError("numpy.core.multiarray failed to import")
23453  *
23454  * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
23455  * try:
23456  * _import_umath()
23457  */
23458 
23459 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
23460  int __pyx_r;
23461  __Pyx_RefNannyDeclarations
23462  PyObject *__pyx_t_1 = NULL;
23463  PyObject *__pyx_t_2 = NULL;
23464  PyObject *__pyx_t_3 = NULL;
23465  int __pyx_t_4;
23466  PyObject *__pyx_t_5 = NULL;
23467  PyObject *__pyx_t_6 = NULL;
23468  PyObject *__pyx_t_7 = NULL;
23469  PyObject *__pyx_t_8 = NULL;
23470  __Pyx_RefNannySetupContext("import_umath", 0);
23471 
23472  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1041
23473  *
23474  * cdef inline int import_umath() except -1:
23475  * try: # <<<<<<<<<<<<<<
23476  * _import_umath()
23477  * except Exception:
23478  */
23479  {
23480  __Pyx_PyThreadState_declare
23481  __Pyx_PyThreadState_assign
23482  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
23483  __Pyx_XGOTREF(__pyx_t_1);
23484  __Pyx_XGOTREF(__pyx_t_2);
23485  __Pyx_XGOTREF(__pyx_t_3);
23486  /*try:*/ {
23487 
23488  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1042
23489  * cdef inline int import_umath() except -1:
23490  * try:
23491  * _import_umath() # <<<<<<<<<<<<<<
23492  * except Exception:
23493  * raise ImportError("numpy.core.umath failed to import")
23494  */
23495  __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1042, __pyx_L3_error)
23496 
23497  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1041
23498  *
23499  * cdef inline int import_umath() except -1:
23500  * try: # <<<<<<<<<<<<<<
23501  * _import_umath()
23502  * except Exception:
23503  */
23504  }
23505  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
23506  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
23507  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
23508  goto __pyx_L8_try_end;
23509  __pyx_L3_error:;
23510 
23511  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1043
23512  * try:
23513  * _import_umath()
23514  * except Exception: # <<<<<<<<<<<<<<
23515  * raise ImportError("numpy.core.umath failed to import")
23516  *
23517  */
23518  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
23519  if (__pyx_t_4) {
23520  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
23521  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1043, __pyx_L5_except_error)
23522  __Pyx_GOTREF(__pyx_t_5);
23523  __Pyx_GOTREF(__pyx_t_6);
23524  __Pyx_GOTREF(__pyx_t_7);
23525 
23526  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1044
23527  * _import_umath()
23528  * except Exception:
23529  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
23530  *
23531  * cdef inline int import_ufunc() except -1:
23532  */
23533  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1044, __pyx_L5_except_error)
23534  __Pyx_GOTREF(__pyx_t_8);
23535  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
23536  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
23537  __PYX_ERR(1, 1044, __pyx_L5_except_error)
23538  }
23539  goto __pyx_L5_except_error;
23540  __pyx_L5_except_error:;
23541 
23542  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1041
23543  *
23544  * cdef inline int import_umath() except -1:
23545  * try: # <<<<<<<<<<<<<<
23546  * _import_umath()
23547  * except Exception:
23548  */
23549  __Pyx_XGIVEREF(__pyx_t_1);
23550  __Pyx_XGIVEREF(__pyx_t_2);
23551  __Pyx_XGIVEREF(__pyx_t_3);
23552  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
23553  goto __pyx_L1_error;
23554  __pyx_L8_try_end:;
23555  }
23556 
23557  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1040
23558  * raise ImportError("numpy.core.multiarray failed to import")
23559  *
23560  * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
23561  * try:
23562  * _import_umath()
23563  */
23564 
23565  /* function exit code */
23566  __pyx_r = 0;
23567  goto __pyx_L0;
23568  __pyx_L1_error:;
23569  __Pyx_XDECREF(__pyx_t_5);
23570  __Pyx_XDECREF(__pyx_t_6);
23571  __Pyx_XDECREF(__pyx_t_7);
23572  __Pyx_XDECREF(__pyx_t_8);
23573  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
23574  __pyx_r = -1;
23575  __pyx_L0:;
23576  __Pyx_RefNannyFinishContext();
23577  return __pyx_r;
23578 }
23579 
23580 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1046
23581  * raise ImportError("numpy.core.umath failed to import")
23582  *
23583  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
23584  * try:
23585  * _import_umath()
23586  */
23587 
23588 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
23589  int __pyx_r;
23590  __Pyx_RefNannyDeclarations
23591  PyObject *__pyx_t_1 = NULL;
23592  PyObject *__pyx_t_2 = NULL;
23593  PyObject *__pyx_t_3 = NULL;
23594  int __pyx_t_4;
23595  PyObject *__pyx_t_5 = NULL;
23596  PyObject *__pyx_t_6 = NULL;
23597  PyObject *__pyx_t_7 = NULL;
23598  PyObject *__pyx_t_8 = NULL;
23599  __Pyx_RefNannySetupContext("import_ufunc", 0);
23600 
23601  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1047
23602  *
23603  * cdef inline int import_ufunc() except -1:
23604  * try: # <<<<<<<<<<<<<<
23605  * _import_umath()
23606  * except Exception:
23607  */
23608  {
23609  __Pyx_PyThreadState_declare
23610  __Pyx_PyThreadState_assign
23611  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
23612  __Pyx_XGOTREF(__pyx_t_1);
23613  __Pyx_XGOTREF(__pyx_t_2);
23614  __Pyx_XGOTREF(__pyx_t_3);
23615  /*try:*/ {
23616 
23617  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1048
23618  * cdef inline int import_ufunc() except -1:
23619  * try:
23620  * _import_umath() # <<<<<<<<<<<<<<
23621  * except Exception:
23622  * raise ImportError("numpy.core.umath failed to import")
23623  */
23624  __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1048, __pyx_L3_error)
23625 
23626  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1047
23627  *
23628  * cdef inline int import_ufunc() except -1:
23629  * try: # <<<<<<<<<<<<<<
23630  * _import_umath()
23631  * except Exception:
23632  */
23633  }
23634  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
23635  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
23636  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
23637  goto __pyx_L8_try_end;
23638  __pyx_L3_error:;
23639 
23640  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1049
23641  * try:
23642  * _import_umath()
23643  * except Exception: # <<<<<<<<<<<<<<
23644  * raise ImportError("numpy.core.umath failed to import")
23645  */
23646  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
23647  if (__pyx_t_4) {
23648  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
23649  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1049, __pyx_L5_except_error)
23650  __Pyx_GOTREF(__pyx_t_5);
23651  __Pyx_GOTREF(__pyx_t_6);
23652  __Pyx_GOTREF(__pyx_t_7);
23653 
23654  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1050
23655  * _import_umath()
23656  * except Exception:
23657  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
23658  */
23659  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1050, __pyx_L5_except_error)
23660  __Pyx_GOTREF(__pyx_t_8);
23661  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
23662  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
23663  __PYX_ERR(1, 1050, __pyx_L5_except_error)
23664  }
23665  goto __pyx_L5_except_error;
23666  __pyx_L5_except_error:;
23667 
23668  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1047
23669  *
23670  * cdef inline int import_ufunc() except -1:
23671  * try: # <<<<<<<<<<<<<<
23672  * _import_umath()
23673  * except Exception:
23674  */
23675  __Pyx_XGIVEREF(__pyx_t_1);
23676  __Pyx_XGIVEREF(__pyx_t_2);
23677  __Pyx_XGIVEREF(__pyx_t_3);
23678  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
23679  goto __pyx_L1_error;
23680  __pyx_L8_try_end:;
23681  }
23682 
23683  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1046
23684  * raise ImportError("numpy.core.umath failed to import")
23685  *
23686  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
23687  * try:
23688  * _import_umath()
23689  */
23690 
23691  /* function exit code */
23692  __pyx_r = 0;
23693  goto __pyx_L0;
23694  __pyx_L1_error:;
23695  __Pyx_XDECREF(__pyx_t_5);
23696  __Pyx_XDECREF(__pyx_t_6);
23697  __Pyx_XDECREF(__pyx_t_7);
23698  __Pyx_XDECREF(__pyx_t_8);
23699  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
23700  __pyx_r = -1;
23701  __pyx_L0:;
23702  __Pyx_RefNannyFinishContext();
23703  return __pyx_r;
23704 }
23705 
23706 static PyMethodDef __pyx_methods[] = {
23707  {0, 0, 0, 0}
23708 };
23709 
23710 #if PY_MAJOR_VERSION >= 3
23711 #if CYTHON_PEP489_MULTI_PHASE_INIT
23712 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
23713 static int __pyx_pymod_exec_subsurfaceTransportFunctions(PyObject* module); /*proto*/
23714 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
23715  {Py_mod_create, (void*)__pyx_pymod_create},
23716  {Py_mod_exec, (void*)__pyx_pymod_exec_subsurfaceTransportFunctions},
23717  {0, NULL}
23718 };
23719 #endif
23720 
23721 static struct PyModuleDef __pyx_moduledef = {
23722  PyModuleDef_HEAD_INIT,
23723  "subsurfaceTransportFunctions",
23724  0, /* m_doc */
23725  #if CYTHON_PEP489_MULTI_PHASE_INIT
23726  0, /* m_size */
23727  #else
23728  -1, /* m_size */
23729  #endif
23730  __pyx_methods /* m_methods */,
23731  #if CYTHON_PEP489_MULTI_PHASE_INIT
23732  __pyx_moduledef_slots, /* m_slots */
23733  #else
23734  NULL, /* m_reload */
23735  #endif
23736  NULL, /* m_traverse */
23737  NULL, /* m_clear */
23738  NULL /* m_free */
23739 };
23740 #endif
23741 #ifndef CYTHON_SMALL_CODE
23742 #if defined(__clang__)
23743  #define CYTHON_SMALL_CODE
23744 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
23745  #define CYTHON_SMALL_CODE __attribute__((cold))
23746 #else
23747  #define CYTHON_SMALL_CODE
23748 #endif
23749 #endif
23750 
23751 static __Pyx_StringTabEntry __pyx_string_tab[] = {
23752  {&__pyx_n_s_DKWr_DpsiC, __pyx_k_DKWr_DpsiC, sizeof(__pyx_k_DKWr_DpsiC), 0, 0, 1, 1},
23753  {&__pyx_n_s_DsBar_DpsiC, __pyx_k_DsBar_DpsiC, sizeof(__pyx_k_DsBar_DpsiC), 0, 0, 1, 1},
23754  {&__pyx_n_s_DthetaW_DpsiC, __pyx_k_DthetaW_DpsiC, sizeof(__pyx_k_DthetaW_DpsiC), 0, 0, 1, 1},
23755  {&__pyx_n_s_DvBar_DpsiC, __pyx_k_DvBar_DpsiC, sizeof(__pyx_k_DvBar_DpsiC), 0, 0, 1, 1},
23756  {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0},
23757  {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0},
23758  {&__pyx_n_s_I, __pyx_k_I, sizeof(__pyx_k_I), 0, 0, 1, 1},
23759  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
23760  {&__pyx_n_s_J, __pyx_k_J, sizeof(__pyx_k_J), 0, 0, 1, 1},
23761  {&__pyx_n_s_KWr, __pyx_k_KWr, sizeof(__pyx_k_KWr), 0, 0, 1, 1},
23762  {&__pyx_n_s_KWs, __pyx_k_KWs, sizeof(__pyx_k_KWs), 0, 0, 1, 1},
23763  {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0},
23764  {&__pyx_n_s_RE_NCP1_evaluateElementCoefficie, __pyx_k_RE_NCP1_evaluateElementCoefficie, sizeof(__pyx_k_RE_NCP1_evaluateElementCoefficie), 0, 0, 1, 1},
23765  {&__pyx_n_s_RE_NCP1_evaluateElementCoefficie_2, __pyx_k_RE_NCP1_evaluateElementCoefficie_2, sizeof(__pyx_k_RE_NCP1_evaluateElementCoefficie_2), 0, 0, 1, 1},
23766  {&__pyx_n_s_RE_NCP1_getElementJacobian, __pyx_k_RE_NCP1_getElementJacobian, sizeof(__pyx_k_RE_NCP1_getElementJacobian), 0, 0, 1, 1},
23767  {&__pyx_n_s_RE_NCP1_getElementResidual, __pyx_k_RE_NCP1_getElementResidual, sizeof(__pyx_k_RE_NCP1_getElementResidual), 0, 0, 1, 1},
23768  {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
23769  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
23770  {&__pyx_n_s_a_avg, __pyx_k_a_avg, sizeof(__pyx_k_a_avg), 0, 0, 1, 1},
23771  {&__pyx_n_s_a_eN, __pyx_k_a_eN, sizeof(__pyx_k_a_eN), 0, 0, 1, 1},
23772  {&__pyx_n_s_a_neig, __pyx_k_a_neig, sizeof(__pyx_k_a_neig), 0, 0, 1, 1},
23773  {&__pyx_n_s_a_up, __pyx_k_a_up, sizeof(__pyx_k_a_up), 0, 0, 1, 1},
23774  {&__pyx_n_s_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 0, 1, 1},
23775  {&__pyx_n_s_beta, __pyx_k_beta, sizeof(__pyx_k_beta), 0, 0, 1, 1},
23776  {&__pyx_n_s_calculateNormalFlux, __pyx_k_calculateNormalFlux, sizeof(__pyx_k_calculateNormalFlux), 0, 0, 1, 1},
23777  {&__pyx_n_s_characteristic_velocity, __pyx_k_characteristic_velocity, sizeof(__pyx_k_characteristic_velocity), 0, 0, 1, 1},
23778  {&__pyx_n_s_characteristic_velocity_dofs, __pyx_k_characteristic_velocity_dofs, sizeof(__pyx_k_characteristic_velocity_dofs), 0, 0, 1, 1},
23779  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
23780  {&__pyx_n_s_clock, __pyx_k_clock, sizeof(__pyx_k_clock), 0, 0, 1, 1},
23781  {&__pyx_n_s_colind, __pyx_k_colind, sizeof(__pyx_k_colind), 0, 0, 1, 1},
23782  {&__pyx_n_s_computeSimpleCharacteristicVeloc, __pyx_k_computeSimpleCharacteristicVeloc, sizeof(__pyx_k_computeSimpleCharacteristicVeloc), 0, 0, 1, 1},
23783  {&__pyx_n_s_computeSimpleCharacteristicVeloc_2, __pyx_k_computeSimpleCharacteristicVeloc_2, sizeof(__pyx_k_computeSimpleCharacteristicVeloc_2), 0, 0, 1, 1},
23784  {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
23785  {&__pyx_n_s_dS, __pyx_k_dS, sizeof(__pyx_k_dS), 0, 0, 1, 1},
23786  {&__pyx_n_s_dV, __pyx_k_dV, sizeof(__pyx_k_dV), 0, 0, 1, 1},
23787  {&__pyx_n_s_denom, __pyx_k_denom, sizeof(__pyx_k_denom), 0, 0, 1, 1},
23788  {&__pyx_n_s_df, __pyx_k_df, sizeof(__pyx_k_df), 0, 0, 1, 1},
23789  {&__pyx_n_s_df_dofs, __pyx_k_df_dofs, sizeof(__pyx_k_df_dofs), 0, 0, 1, 1},
23790  {&__pyx_n_s_dkr_up, __pyx_k_dkr_up, sizeof(__pyx_k_dkr_up), 0, 0, 1, 1},
23791  {&__pyx_n_s_dm, __pyx_k_dm, sizeof(__pyx_k_dm), 0, 0, 1, 1},
23792  {&__pyx_n_s_dmt, __pyx_k_dmt, sizeof(__pyx_k_dmt), 0, 0, 1, 1},
23793  {&__pyx_n_s_dmtj_avg, __pyx_k_dmtj_avg, sizeof(__pyx_k_dmtj_avg), 0, 0, 1, 1},
23794  {&__pyx_n_s_dot, __pyx_k_dot, sizeof(__pyx_k_dot), 0, 0, 1, 1},
23795  {&__pyx_n_s_drhom, __pyx_k_drhom, sizeof(__pyx_k_drhom), 0, 0, 1, 1},
23796  {&__pyx_n_s_eN, __pyx_k_eN, sizeof(__pyx_k_eN), 0, 0, 1, 1},
23797  {&__pyx_n_s_eN_left, __pyx_k_eN_left, sizeof(__pyx_k_eN_left), 0, 0, 1, 1},
23798  {&__pyx_n_s_eN_neighbor, __pyx_k_eN_neighbor, sizeof(__pyx_k_eN_neighbor), 0, 0, 1, 1},
23799  {&__pyx_n_s_eN_right, __pyx_k_eN_right, sizeof(__pyx_k_eN_right), 0, 0, 1, 1},
23800  {&__pyx_n_s_ebN, __pyx_k_ebN, sizeof(__pyx_k_ebN), 0, 0, 1, 1},
23801  {&__pyx_n_s_ebNE, __pyx_k_ebNE, sizeof(__pyx_k_ebNE), 0, 0, 1, 1},
23802  {&__pyx_n_s_ebN_local, __pyx_k_ebN_local, sizeof(__pyx_k_ebN_local), 0, 0, 1, 1},
23803  {&__pyx_n_s_ebq_global_vals, __pyx_k_ebq_global_vals, sizeof(__pyx_k_ebq_global_vals), 0, 0, 1, 1},
23804  {&__pyx_n_s_ebq_vals, __pyx_k_ebq_vals, sizeof(__pyx_k_ebq_vals), 0, 0, 1, 1},
23805  {&__pyx_n_s_elementBarycentersArray, __pyx_k_elementBarycentersArray, sizeof(__pyx_k_elementBarycentersArray), 0, 0, 1, 1},
23806  {&__pyx_n_s_elementBoundariesArray, __pyx_k_elementBoundariesArray, sizeof(__pyx_k_elementBoundariesArray), 0, 0, 1, 1},
23807  {&__pyx_n_s_elementBoundaryElementsArray, __pyx_k_elementBoundaryElementsArray, sizeof(__pyx_k_elementBoundaryElementsArray), 0, 0, 1, 1},
23808  {&__pyx_n_s_elementBoundaryMaterialTypes, __pyx_k_elementBoundaryMaterialTypes, sizeof(__pyx_k_elementBoundaryMaterialTypes), 0, 0, 1, 1},
23809  {&__pyx_n_s_elementBoundaryTypes, __pyx_k_elementBoundaryTypes, sizeof(__pyx_k_elementBoundaryTypes), 0, 0, 1, 1},
23810  {&__pyx_n_s_elementJacobian, __pyx_k_elementJacobian, sizeof(__pyx_k_elementJacobian), 0, 0, 1, 1},
23811  {&__pyx_n_s_elementMaterialTypes, __pyx_k_elementMaterialTypes, sizeof(__pyx_k_elementMaterialTypes), 0, 0, 1, 1},
23812  {&__pyx_n_s_elementNeighborsArray, __pyx_k_elementNeighborsArray, sizeof(__pyx_k_elementNeighborsArray), 0, 0, 1, 1},
23813  {&__pyx_n_s_elementResidual, __pyx_k_elementResidual, sizeof(__pyx_k_elementResidual), 0, 0, 1, 1},
23814  {&__pyx_n_s_evaluateScalarMaterialFunctionOv, __pyx_k_evaluateScalarMaterialFunctionOv, sizeof(__pyx_k_evaluateScalarMaterialFunctionOv), 0, 0, 1, 1},
23815  {&__pyx_n_s_evaluateScalarMaterialFunctionOv_2, __pyx_k_evaluateScalarMaterialFunctionOv_2, sizeof(__pyx_k_evaluateScalarMaterialFunctionOv_2), 0, 0, 1, 1},
23816  {&__pyx_n_s_evaluateScalarMaterialFunctionOv_3, __pyx_k_evaluateScalarMaterialFunctionOv_3, sizeof(__pyx_k_evaluateScalarMaterialFunctionOv_3), 0, 0, 1, 1},
23817  {&__pyx_n_s_evaluateSparseTensorMaterialFunc, __pyx_k_evaluateSparseTensorMaterialFunc, sizeof(__pyx_k_evaluateSparseTensorMaterialFunc), 0, 0, 1, 1},
23818  {&__pyx_n_s_evaluateSparseTensorMaterialFunc_2, __pyx_k_evaluateSparseTensorMaterialFunc_2, sizeof(__pyx_k_evaluateSparseTensorMaterialFunc_2), 0, 0, 1, 1},
23819  {&__pyx_n_s_evaluateVectorMaterialFunctionOv, __pyx_k_evaluateVectorMaterialFunctionOv, sizeof(__pyx_k_evaluateVectorMaterialFunctionOv), 0, 0, 1, 1},
23820  {&__pyx_n_s_exteriorElementBoundariesArray, __pyx_k_exteriorElementBoundariesArray, sizeof(__pyx_k_exteriorElementBoundariesArray), 0, 0, 1, 1},
23821  {&__pyx_n_s_exteriorElementBoundaryMaterialT, __pyx_k_exteriorElementBoundaryMaterialT, sizeof(__pyx_k_exteriorElementBoundaryMaterialT), 0, 0, 1, 1},
23822  {&__pyx_n_s_f_up, __pyx_k_f_up, sizeof(__pyx_k_f_up), 0, 0, 1, 1},
23823  {&__pyx_n_s_flat, __pyx_k_flat, sizeof(__pyx_k_flat), 0, 0, 1, 1},
23824  {&__pyx_n_s_flux, __pyx_k_flux, sizeof(__pyx_k_flux), 0, 0, 1, 1},
23825  {&__pyx_n_s_gravity, __pyx_k_gravity, sizeof(__pyx_k_gravity), 0, 0, 1, 1},
23826  {&__pyx_n_s_helicalElementVelocityEval3, __pyx_k_helicalElementVelocityEval3, sizeof(__pyx_k_helicalElementVelocityEval3), 0, 0, 1, 1},
23827  {&__pyx_n_s_helicalElementVelocityEval4, __pyx_k_helicalElementVelocityEval4, sizeof(__pyx_k_helicalElementVelocityEval4), 0, 0, 1, 1},
23828  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
23829  {&__pyx_n_s_ii, __pyx_k_ii, sizeof(__pyx_k_ii), 0, 0, 1, 1},
23830  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
23831  {&__pyx_n_s_integral, __pyx_k_integral, sizeof(__pyx_k_integral), 0, 0, 1, 1},
23832  {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1},
23833  {&__pyx_n_s_jacobian_weak_residual, __pyx_k_jacobian_weak_residual, sizeof(__pyx_k_jacobian_weak_residual), 0, 0, 1, 1},
23834  {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
23835  {&__pyx_n_s_kb, __pyx_k_kb, sizeof(__pyx_k_kb), 0, 0, 1, 1},
23836  {&__pyx_n_s_kr_eN, __pyx_k_kr_eN, sizeof(__pyx_k_kr_eN), 0, 0, 1, 1},
23837  {&__pyx_n_s_kr_neig, __pyx_k_kr_neig, sizeof(__pyx_k_kr_neig), 0, 0, 1, 1},
23838  {&__pyx_n_s_l2g, __pyx_k_l2g, sizeof(__pyx_k_l2g), 0, 0, 1, 1},
23839  {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1},
23840  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
23841  {&__pyx_n_s_matID, __pyx_k_matID, sizeof(__pyx_k_matID), 0, 0, 1, 1},
23842  {&__pyx_n_s_matID_neig, __pyx_k_matID_neig, sizeof(__pyx_k_matID_neig), 0, 0, 1, 1},
23843  {&__pyx_n_s_material, __pyx_k_material, sizeof(__pyx_k_material), 0, 0, 1, 1},
23844  {&__pyx_n_s_material_functions, __pyx_k_material_functions, sizeof(__pyx_k_material_functions), 0, 0, 1, 1},
23845  {&__pyx_n_s_material_left, __pyx_k_material_left, sizeof(__pyx_k_material_left), 0, 0, 1, 1},
23846  {&__pyx_n_s_material_right, __pyx_k_material_right, sizeof(__pyx_k_material_right), 0, 0, 1, 1},
23847  {&__pyx_n_s_mt, __pyx_k_mt, sizeof(__pyx_k_mt), 0, 0, 1, 1},
23848  {&__pyx_n_s_mt_avg, __pyx_k_mt_avg, sizeof(__pyx_k_mt_avg), 0, 0, 1, 1},
23849  {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
23850  {&__pyx_n_s_nAvgWeight, __pyx_k_nAvgWeight, sizeof(__pyx_k_nAvgWeight), 0, 0, 1, 1},
23851  {&__pyx_n_s_nDOF_test_element, __pyx_k_nDOF_test_element, sizeof(__pyx_k_nDOF_test_element), 0, 0, 1, 1},
23852  {&__pyx_n_s_nDOF_trial_element, __pyx_k_nDOF_trial_element, sizeof(__pyx_k_nDOF_trial_element), 0, 0, 1, 1},
23853  {&__pyx_n_s_nElementBoundaries_element, __pyx_k_nElementBoundaries_element, sizeof(__pyx_k_nElementBoundaries_element), 0, 0, 1, 1},
23854  {&__pyx_n_s_nElementBoundaries_global, __pyx_k_nElementBoundaries_global, sizeof(__pyx_k_nElementBoundaries_global), 0, 0, 1, 1},
23855  {&__pyx_n_s_nElements_global, __pyx_k_nElements_global, sizeof(__pyx_k_nElements_global), 0, 0, 1, 1},
23856  {&__pyx_n_s_nExteriorElementBoundaries_globa, __pyx_k_nExteriorElementBoundaries_globa, sizeof(__pyx_k_nExteriorElementBoundaries_globa), 0, 0, 1, 1},
23857  {&__pyx_n_s_nSpace, __pyx_k_nSpace, sizeof(__pyx_k_nSpace), 0, 0, 1, 1},
23858  {&__pyx_n_s_nSpace2, __pyx_k_nSpace2, sizeof(__pyx_k_nSpace2), 0, 0, 1, 1},
23859  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
23860  {&__pyx_n_s_nd, __pyx_k_nd, sizeof(__pyx_k_nd), 0, 0, 1, 1},
23861  {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0},
23862  {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0},
23863  {&__pyx_n_s_nnz, __pyx_k_nnz, sizeof(__pyx_k_nnz), 0, 0, 1, 1},
23864  {&__pyx_n_s_numer, __pyx_k_numer, sizeof(__pyx_k_numer), 0, 0, 1, 1},
23865  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
23866  {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0},
23867  {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0},
23868  {&__pyx_n_s_omega_e, __pyx_k_omega_e, sizeof(__pyx_k_omega_e), 0, 0, 1, 1},
23869  {&__pyx_n_s_one8, __pyx_k_one8, sizeof(__pyx_k_one8), 0, 0, 1, 1},
23870  {&__pyx_n_s_onePlus_pcBar_n, __pyx_k_onePlus_pcBar_n, sizeof(__pyx_k_onePlus_pcBar_n), 0, 0, 1, 1},
23871  {&__pyx_n_s_pcBar, __pyx_k_pcBar, sizeof(__pyx_k_pcBar), 0, 0, 1, 1},
23872  {&__pyx_n_s_pcBar_n, __pyx_k_pcBar_n, sizeof(__pyx_k_pcBar_n), 0, 0, 1, 1},
23873  {&__pyx_n_s_pcBar_nM1, __pyx_k_pcBar_nM1, sizeof(__pyx_k_pcBar_nM1), 0, 0, 1, 1},
23874  {&__pyx_n_s_pcBar_nM2, __pyx_k_pcBar_nM2, sizeof(__pyx_k_pcBar_nM2), 0, 0, 1, 1},
23875  {&__pyx_n_s_phi_eN, __pyx_k_phi_eN, sizeof(__pyx_k_phi_eN), 0, 0, 1, 1},
23876  {&__pyx_n_s_phi_neig, __pyx_k_phi_neig, sizeof(__pyx_k_phi_neig), 0, 0, 1, 1},
23877  {&__pyx_n_s_pi, __pyx_k_pi, sizeof(__pyx_k_pi), 0, 0, 1, 1},
23878  {&__pyx_n_s_picard, __pyx_k_picard, sizeof(__pyx_k_picard), 0, 0, 1, 1},
23879  {&__pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_k_proteus_subsurfaceTransportFunct, sizeof(__pyx_k_proteus_subsurfaceTransportFunct), 0, 0, 1, 0},
23880  {&__pyx_n_s_psiC, __pyx_k_psiC, sizeof(__pyx_k_psiC), 0, 0, 1, 1},
23881  {&__pyx_n_s_q, __pyx_k_q, sizeof(__pyx_k_q), 0, 0, 1, 1},
23882  {&__pyx_n_s_q_alin, __pyx_k_q_alin, sizeof(__pyx_k_q_alin), 0, 0, 1, 1},
23883  {&__pyx_n_s_q_detJ, __pyx_k_q_detJ, sizeof(__pyx_k_q_detJ), 0, 0, 1, 1},
23884  {&__pyx_n_s_q_dkr, __pyx_k_q_dkr, sizeof(__pyx_k_q_dkr), 0, 0, 1, 1},
23885  {&__pyx_n_s_q_dm, __pyx_k_q_dm, sizeof(__pyx_k_q_dm), 0, 0, 1, 1},
23886  {&__pyx_n_s_q_dmass, __pyx_k_q_dmass, sizeof(__pyx_k_q_dmass), 0, 0, 1, 1},
23887  {&__pyx_n_s_q_dmt, __pyx_k_q_dmt, sizeof(__pyx_k_q_dmt), 0, 0, 1, 1},
23888  {&__pyx_n_s_q_flin, __pyx_k_q_flin, sizeof(__pyx_k_q_flin), 0, 0, 1, 1},
23889  {&__pyx_n_s_q_grad_u, __pyx_k_q_grad_u, sizeof(__pyx_k_q_grad_u), 0, 0, 1, 1},
23890  {&__pyx_n_s_q_grad_v, __pyx_k_q_grad_v, sizeof(__pyx_k_q_grad_v), 0, 0, 1, 1},
23891  {&__pyx_n_s_q_grad_w, __pyx_k_q_grad_w, sizeof(__pyx_k_q_grad_w), 0, 0, 1, 1},
23892  {&__pyx_n_s_q_kr, __pyx_k_q_kr, sizeof(__pyx_k_q_kr), 0, 0, 1, 1},
23893  {&__pyx_n_s_q_kr_up, __pyx_k_q_kr_up, sizeof(__pyx_k_q_kr_up), 0, 0, 1, 1},
23894  {&__pyx_n_s_q_m, __pyx_k_q_m, sizeof(__pyx_k_q_m), 0, 0, 1, 1},
23895  {&__pyx_n_s_q_mass, __pyx_k_q_mass, sizeof(__pyx_k_q_mass), 0, 0, 1, 1},
23896  {&__pyx_n_s_q_mt, __pyx_k_q_mt, sizeof(__pyx_k_q_mt), 0, 0, 1, 1},
23897  {&__pyx_n_s_q_r, __pyx_k_q_r, sizeof(__pyx_k_q_r), 0, 0, 1, 1},
23898  {&__pyx_n_s_q_u, __pyx_k_q_u, sizeof(__pyx_k_q_u), 0, 0, 1, 1},
23899  {&__pyx_n_s_q_vals, __pyx_k_q_vals, sizeof(__pyx_k_q_vals), 0, 0, 1, 1},
23900  {&__pyx_n_s_q_x, __pyx_k_q_x, sizeof(__pyx_k_q_x), 0, 0, 1, 1},
23901  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
23902  {&__pyx_n_s_rho, __pyx_k_rho, sizeof(__pyx_k_rho), 0, 0, 1, 1},
23903  {&__pyx_n_s_rho2, __pyx_k_rho2, sizeof(__pyx_k_rho2), 0, 0, 1, 1},
23904  {&__pyx_n_s_rhom, __pyx_k_rhom, sizeof(__pyx_k_rhom), 0, 0, 1, 1},
23905  {&__pyx_n_s_rotatingGaussianElementVelocityE, __pyx_k_rotatingGaussianElementVelocityE, sizeof(__pyx_k_rotatingGaussianElementVelocityE), 0, 0, 1, 1},
23906  {&__pyx_n_s_rotatingGaussianElementVelocityE_2, __pyx_k_rotatingGaussianElementVelocityE_2, sizeof(__pyx_k_rotatingGaussianElementVelocityE_2), 0, 0, 1, 1},
23907  {&__pyx_n_s_rowptr, __pyx_k_rowptr, sizeof(__pyx_k_rowptr), 0, 0, 1, 1},
23908  {&__pyx_n_s_sBar, __pyx_k_sBar, sizeof(__pyx_k_sBar), 0, 0, 1, 1},
23909  {&__pyx_n_s_setElementBoundariesArray, __pyx_k_setElementBoundariesArray, sizeof(__pyx_k_setElementBoundariesArray), 0, 0, 1, 1},
23910  {&__pyx_n_s_setExteriorElementBoundaryTypes, __pyx_k_setExteriorElementBoundaryTypes, sizeof(__pyx_k_setExteriorElementBoundaryTypes), 0, 0, 1, 1},
23911  {&__pyx_n_s_setScalarMaterialFunctionOverEle, __pyx_k_setScalarMaterialFunctionOverEle, sizeof(__pyx_k_setScalarMaterialFunctionOverEle), 0, 0, 1, 1},
23912  {&__pyx_n_s_setScalarMaterialFunctionOverEle_2, __pyx_k_setScalarMaterialFunctionOverEle_2, sizeof(__pyx_k_setScalarMaterialFunctionOverEle_2), 0, 0, 1, 1},
23913  {&__pyx_n_s_setScalarMaterialFunctionOverGlo, __pyx_k_setScalarMaterialFunctionOverGlo, sizeof(__pyx_k_setScalarMaterialFunctionOverGlo), 0, 0, 1, 1},
23914  {&__pyx_n_s_setSparseTensorMaterialFunctionO, __pyx_k_setSparseTensorMaterialFunctionO, sizeof(__pyx_k_setSparseTensorMaterialFunctionO), 0, 0, 1, 1},
23915  {&__pyx_n_s_setSparseTensorMaterialFunctionO_2, __pyx_k_setSparseTensorMaterialFunctionO_2, sizeof(__pyx_k_setSparseTensorMaterialFunctionO_2), 0, 0, 1, 1},
23916  {&__pyx_n_s_setVectorMaterialFunctionOverEle, __pyx_k_setVectorMaterialFunctionOverEle, sizeof(__pyx_k_setVectorMaterialFunctionOverEle), 0, 0, 1, 1},
23917  {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
23918  {&__pyx_n_s_sqrt_sBar, __pyx_k_sqrt_sBar, sizeof(__pyx_k_sqrt_sBar), 0, 0, 1, 1},
23919  {&__pyx_n_s_subsurfaceTransportFunctions, __pyx_k_subsurfaceTransportFunctions, sizeof(__pyx_k_subsurfaceTransportFunctions), 0, 0, 1, 1},
23920  {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1},
23921  {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
23922  {&__pyx_n_s_tForReversal, __pyx_k_tForReversal, sizeof(__pyx_k_tForReversal), 0, 0, 1, 1},
23923  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
23924  {&__pyx_n_s_thetaR, __pyx_k_thetaR, sizeof(__pyx_k_thetaR), 0, 0, 1, 1},
23925  {&__pyx_n_s_thetaS, __pyx_k_thetaS, sizeof(__pyx_k_thetaS), 0, 0, 1, 1},
23926  {&__pyx_n_s_thetaSR, __pyx_k_thetaSR, sizeof(__pyx_k_thetaSR), 0, 0, 1, 1},
23927  {&__pyx_n_s_thetaW, __pyx_k_thetaW, sizeof(__pyx_k_thetaW), 0, 0, 1, 1},
23928  {&__pyx_n_s_thisElementIsUpwind, __pyx_k_thisElementIsUpwind, sizeof(__pyx_k_thisElementIsUpwind), 0, 0, 1, 1},
23929  {&__pyx_n_s_transient, __pyx_k_transient, sizeof(__pyx_k_transient), 0, 0, 1, 1},
23930  {&__pyx_n_s_u_dof, __pyx_k_u_dof, sizeof(__pyx_k_u_dof), 0, 0, 1, 1},
23931  {&__pyx_n_s_u_eN, __pyx_k_u_eN, sizeof(__pyx_k_u_eN), 0, 0, 1, 1},
23932  {&__pyx_n_s_u_j, __pyx_k_u_j, sizeof(__pyx_k_u_j), 0, 0, 1, 1},
23933  {&__pyx_n_s_u_l2g, __pyx_k_u_l2g, sizeof(__pyx_k_u_l2g), 0, 0, 1, 1},
23934  {&__pyx_n_s_u_neig, __pyx_k_u_neig, sizeof(__pyx_k_u_neig), 0, 0, 1, 1},
23935  {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0},
23936  {&__pyx_n_s_updateMassJacobian_weakAvg, __pyx_k_updateMassJacobian_weakAvg, sizeof(__pyx_k_updateMassJacobian_weakAvg), 0, 0, 1, 1},
23937  {&__pyx_n_s_updateMass_weakAvg, __pyx_k_updateMass_weakAvg, sizeof(__pyx_k_updateMass_weakAvg), 0, 0, 1, 1},
23938  {&__pyx_n_s_upwindFlag, __pyx_k_upwindFlag, sizeof(__pyx_k_upwindFlag), 0, 0, 1, 1},
23939  {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
23940  {&__pyx_n_s_vBar, __pyx_k_vBar, sizeof(__pyx_k_vBar), 0, 0, 1, 1},
23941  {&__pyx_n_s_vBar2, __pyx_k_vBar2, sizeof(__pyx_k_vBar2), 0, 0, 1, 1},
23942  {&__pyx_n_s_vol, __pyx_k_vol, sizeof(__pyx_k_vol), 0, 0, 1, 1},
23943  {&__pyx_n_s_volFactor, __pyx_k_volFactor, sizeof(__pyx_k_volFactor), 0, 0, 1, 1},
23944  {&__pyx_n_s_vol_e, __pyx_k_vol_e, sizeof(__pyx_k_vol_e), 0, 0, 1, 1},
23945  {&__pyx_n_s_volume, __pyx_k_volume, sizeof(__pyx_k_volume), 0, 0, 1, 1},
23946  {&__pyx_n_s_vortexElementVelocityEval3, __pyx_k_vortexElementVelocityEval3, sizeof(__pyx_k_vortexElementVelocityEval3), 0, 0, 1, 1},
23947  {&__pyx_n_s_vortexElementVelocityEval4, __pyx_k_vortexElementVelocityEval4, sizeof(__pyx_k_vortexElementVelocityEval4), 0, 0, 1, 1},
23948  {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
23949  {&__pyx_n_s_weak_residual, __pyx_k_weak_residual, sizeof(__pyx_k_weak_residual), 0, 0, 1, 1},
23950  {&__pyx_n_s_weight, __pyx_k_weight, sizeof(__pyx_k_weight), 0, 0, 1, 1},
23951  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
23952  {&__pyx_n_s_xc, __pyx_k_xc, sizeof(__pyx_k_xc), 0, 0, 1, 1},
23953  {&__pyx_n_s_yc, __pyx_k_yc, sizeof(__pyx_k_yc), 0, 0, 1, 1},
23954  {&__pyx_n_s_zVelocity, __pyx_k_zVelocity, sizeof(__pyx_k_zVelocity), 0, 0, 1, 1},
23955  {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
23956  {&__pyx_n_s_zvelocity, __pyx_k_zvelocity, sizeof(__pyx_k_zvelocity), 0, 0, 1, 1},
23957  {0, 0, 0, 0, 0, 0, 0}
23958 };
23959 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
23960  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 24, __pyx_L1_error)
23961  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 272, __pyx_L1_error)
23962  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 856, __pyx_L1_error)
23963  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 1038, __pyx_L1_error)
23964  return 0;
23965  __pyx_L1_error:;
23966  return -1;
23967 }
23968 
23969 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
23970  __Pyx_RefNannyDeclarations
23971  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
23972 
23973  /* "subsurfaceTransportFunctions.pyx":66
23974  * material = elementMaterialTypes[eN]
23975  * for k in range(q_vals.shape[1]):
23976  * q_vals[eN,k,:] = material_functions[material].flat # <<<<<<<<<<<<<<
23977  *
23978  *
23979  */
23980  __pyx_slice_ = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice_)) __PYX_ERR(0, 66, __pyx_L1_error)
23981  __Pyx_GOTREF(__pyx_slice_);
23982  __Pyx_GIVEREF(__pyx_slice_);
23983 
23984  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":272
23985  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
23986  * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
23987  * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
23988  *
23989  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
23990  */
23991  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 272, __pyx_L1_error)
23992  __Pyx_GOTREF(__pyx_tuple__2);
23993  __Pyx_GIVEREF(__pyx_tuple__2);
23994 
23995  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":276
23996  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
23997  * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
23998  * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
23999  *
24000  * info.buf = PyArray_DATA(self)
24001  */
24002  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 276, __pyx_L1_error)
24003  __Pyx_GOTREF(__pyx_tuple__3);
24004  __Pyx_GIVEREF(__pyx_tuple__3);
24005 
24006  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":306
24007  * if ((descr.byteorder == c'>' and little_endian) or
24008  * (descr.byteorder == c'<' and not little_endian)):
24009  * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
24010  * if t == NPY_BYTE: f = "b"
24011  * elif t == NPY_UBYTE: f = "B"
24012  */
24013  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 306, __pyx_L1_error)
24014  __Pyx_GOTREF(__pyx_tuple__4);
24015  __Pyx_GIVEREF(__pyx_tuple__4);
24016 
24017  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":856
24018  *
24019  * if (end - f) - <int>(new_offset - offset[0]) < 15:
24020  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
24021  *
24022  * if ((child.byteorder == c'>' and little_endian) or
24023  */
24024  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 856, __pyx_L1_error)
24025  __Pyx_GOTREF(__pyx_tuple__5);
24026  __Pyx_GIVEREF(__pyx_tuple__5);
24027 
24028  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":880
24029  * t = child.type_num
24030  * if end - f < 5:
24031  * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
24032  *
24033  * # Until ticket #99 is fixed, use integers to avoid warnings
24034  */
24035  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 880, __pyx_L1_error)
24036  __Pyx_GOTREF(__pyx_tuple__6);
24037  __Pyx_GIVEREF(__pyx_tuple__6);
24038 
24039  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1038
24040  * _import_array()
24041  * except Exception:
24042  * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
24043  *
24044  * cdef inline int import_umath() except -1:
24045  */
24046  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 1038, __pyx_L1_error)
24047  __Pyx_GOTREF(__pyx_tuple__7);
24048  __Pyx_GIVEREF(__pyx_tuple__7);
24049 
24050  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1044
24051  * _import_umath()
24052  * except Exception:
24053  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
24054  *
24055  * cdef inline int import_ufunc() except -1:
24056  */
24057  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 1044, __pyx_L1_error)
24058  __Pyx_GOTREF(__pyx_tuple__8);
24059  __Pyx_GIVEREF(__pyx_tuple__8);
24060 
24061  /* "subsurfaceTransportFunctions.pyx":18
24062  * ctypedef int ITYPE_t
24063  *
24064  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
24065  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
24066  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
24067  */
24068  __pyx_tuple__9 = PyTuple_Pack(8, __pyx_n_s_nExteriorElementBoundaries_globa, __pyx_n_s_exteriorElementBoundariesArray, __pyx_n_s_elementBoundaryElementsArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_exteriorElementBoundaryMaterialT, __pyx_n_s_ebNE, __pyx_n_s_ebN, __pyx_n_s_eN); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 18, __pyx_L1_error)
24069  __Pyx_GOTREF(__pyx_tuple__9);
24070  __Pyx_GIVEREF(__pyx_tuple__9);
24071  __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setExteriorElementBoundaryTypes, 18, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 18, __pyx_L1_error)
24072 
24073  /* "subsurfaceTransportFunctions.pyx":29
24074  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
24075  *
24076  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
24077  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
24078  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
24079  */
24080  __pyx_tuple__11 = PyTuple_Pack(7, __pyx_n_s_nElementBoundaries_global, __pyx_n_s_elementBoundaryElementsArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_elementBoundaryMaterialTypes, __pyx_n_s_ebN, __pyx_n_s_eN_left, __pyx_n_s_eN_right); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 29, __pyx_L1_error)
24081  __Pyx_GOTREF(__pyx_tuple__11);
24082  __Pyx_GIVEREF(__pyx_tuple__11);
24083  __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(4, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setElementBoundariesArray, 29, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 29, __pyx_L1_error)
24084 
24085  /* "subsurfaceTransportFunctions.pyx":43
24086  *
24087  * ###
24088  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
24089  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
24090  * dict material_functions):
24091  */
24092  __pyx_tuple__13 = PyTuple_Pack(6, __pyx_n_s_elementMaterialTypes, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 43, __pyx_L1_error)
24093  __Pyx_GOTREF(__pyx_tuple__13);
24094  __Pyx_GIVEREF(__pyx_tuple__13);
24095  __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setScalarMaterialFunctionOverEle, 43, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 43, __pyx_L1_error)
24096 
24097  /* "subsurfaceTransportFunctions.pyx":56
24098  * q_vals[eN,k] = material_functions[material]
24099  *
24100  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
24101  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
24102  * dict material_functions):
24103  */
24104  __pyx_tuple__15 = PyTuple_Pack(6, __pyx_n_s_elementMaterialTypes, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 56, __pyx_L1_error)
24105  __Pyx_GOTREF(__pyx_tuple__15);
24106  __Pyx_GIVEREF(__pyx_tuple__15);
24107  __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setVectorMaterialFunctionOverEle, 56, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 56, __pyx_L1_error)
24108 
24109  /* "subsurfaceTransportFunctions.pyx":69
24110  *
24111  *
24112  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
24113  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24114  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
24115  */
24116  __pyx_tuple__17 = PyTuple_Pack(10, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 69, __pyx_L1_error)
24117  __Pyx_GOTREF(__pyx_tuple__17);
24118  __Pyx_GIVEREF(__pyx_tuple__17);
24119  __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(4, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setScalarMaterialFunctionOverEle_2, 69, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 69, __pyx_L1_error)
24120 
24121  /* "subsurfaceTransportFunctions.pyx":91
24122  * material_functions[material_right])
24123  *
24124  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
24125  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24126  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24127  */
24128  __pyx_tuple__19 = PyTuple_Pack(15, __pyx_n_s_nd, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 91, __pyx_L1_error)
24129  __Pyx_GOTREF(__pyx_tuple__19);
24130  __Pyx_GIVEREF(__pyx_tuple__19);
24131  __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(5, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setSparseTensorMaterialFunctionO, 91, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 91, __pyx_L1_error)
24132 
24133  /* "subsurfaceTransportFunctions.pyx":118
24134  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
24135  *
24136  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
24137  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24138  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
24139  */
24140  __pyx_tuple__21 = PyTuple_Pack(8, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_k); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 118, __pyx_L1_error)
24141  __Pyx_GOTREF(__pyx_tuple__21);
24142  __Pyx_GIVEREF(__pyx_tuple__21);
24143  __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(4, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setScalarMaterialFunctionOverGlo, 118, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 118, __pyx_L1_error)
24144 
24145  /* "subsurfaceTransportFunctions.pyx":139
24146  *
24147  *
24148  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
24149  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24150  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24151  */
24152  __pyx_tuple__23 = PyTuple_Pack(13, __pyx_n_s_nd, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 139, __pyx_L1_error)
24153  __Pyx_GOTREF(__pyx_tuple__23);
24154  __Pyx_GIVEREF(__pyx_tuple__23);
24155  __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(5, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setSparseTensorMaterialFunctionO_2, 139, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 139, __pyx_L1_error)
24156 
24157  /* "subsurfaceTransportFunctions.pyx":165
24158  *
24159  * ###
24160  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
24161  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
24162  * numpy.ndarray[DTYPE_t,ndim=3] x,
24163  */
24164  __pyx_tuple__25 = PyTuple_Pack(8, __pyx_n_s_t, __pyx_n_s_elementMaterialTypes, __pyx_n_s_x, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 165, __pyx_L1_error)
24165  __Pyx_GOTREF(__pyx_tuple__25);
24166  __Pyx_GIVEREF(__pyx_tuple__25);
24167  __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateScalarMaterialFunctionOv, 165, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 165, __pyx_L1_error)
24168 
24169  /* "subsurfaceTransportFunctions.pyx":180
24170  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
24171  *
24172  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
24173  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
24174  * numpy.ndarray[DTYPE_t,ndim=3] x,
24175  */
24176  __pyx_tuple__27 = PyTuple_Pack(8, __pyx_n_s_t, __pyx_n_s_elementMaterialTypes, __pyx_n_s_x, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 180, __pyx_L1_error)
24177  __Pyx_GOTREF(__pyx_tuple__27);
24178  __Pyx_GIVEREF(__pyx_tuple__27);
24179  __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateVectorMaterialFunctionOv, 180, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 180, __pyx_L1_error)
24180 
24181  /* "subsurfaceTransportFunctions.pyx":195
24182  *
24183  *
24184  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
24185  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24186  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24187  */
24188  __pyx_tuple__29 = PyTuple_Pack(12, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 195, __pyx_L1_error)
24189  __Pyx_GOTREF(__pyx_tuple__29);
24190  __Pyx_GIVEREF(__pyx_tuple__29);
24191  __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(6, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateScalarMaterialFunctionOv_2, 195, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 195, __pyx_L1_error)
24192 
24193  /* "subsurfaceTransportFunctions.pyx":219
24194  * material_functions[material_right](x[eN,ebN_local,k],t))
24195  *
24196  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
24197  * double t,
24198  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24199  */
24200  __pyx_tuple__31 = PyTuple_Pack(17, __pyx_n_s_nd, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 219, __pyx_L1_error)
24201  __Pyx_GOTREF(__pyx_tuple__31);
24202  __Pyx_GIVEREF(__pyx_tuple__31);
24203  __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(7, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateSparseTensorMaterialFunc, 219, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 219, __pyx_L1_error)
24204 
24205  /* "subsurfaceTransportFunctions.pyx":248
24206  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
24207  *
24208  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
24209  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24210  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24211  */
24212  __pyx_tuple__33 = PyTuple_Pack(10, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_k); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 248, __pyx_L1_error)
24213  __Pyx_GOTREF(__pyx_tuple__33);
24214  __Pyx_GIVEREF(__pyx_tuple__33);
24215  __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(6, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateScalarMaterialFunctionOv_3, 248, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 248, __pyx_L1_error)
24216 
24217  /* "subsurfaceTransportFunctions.pyx":271
24218  *
24219  *
24220  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
24221  * double t,
24222  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24223  */
24224  __pyx_tuple__35 = PyTuple_Pack(15, __pyx_n_s_nd, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 271, __pyx_L1_error)
24225  __Pyx_GOTREF(__pyx_tuple__35);
24226  __Pyx_GIVEREF(__pyx_tuple__35);
24227  __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(7, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateSparseTensorMaterialFunc_2, 271, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 271, __pyx_L1_error)
24228 
24229  /* "subsurfaceTransportFunctions.pyx":301
24230  *
24231  * ##################################################
24232  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
24233  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
24234  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
24235  */
24236  __pyx_tuple__37 = PyTuple_Pack(24, __pyx_n_s_rho, __pyx_n_s_gravity, __pyx_n_s_rowptr, __pyx_n_s_colind, __pyx_n_s_KWs, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_q_flin, __pyx_n_s_q_alin, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_ebN, __pyx_n_s_matID, __pyx_n_s_matID_neig, __pyx_n_s_nSpace2, __pyx_n_s_nnz, __pyx_n_s_a_eN, __pyx_n_s_a_neig, __pyx_n_s_a_avg); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 301, __pyx_L1_error)
24237  __Pyx_GOTREF(__pyx_tuple__37);
24238  __Pyx_GIVEREF(__pyx_tuple__37);
24239  __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(12, 0, 24, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_RE_NCP1_evaluateElementCoefficie, 301, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 301, __pyx_L1_error)
24240 
24241  /* "subsurfaceTransportFunctions.pyx":359
24242  *
24243  *
24244  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
24245  * double beta,
24246  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
24247  */
24248  __pyx_tuple__39 = PyTuple_Pack(61, __pyx_n_s_rho, __pyx_n_s_beta, __pyx_n_s_gravity, __pyx_n_s_alpha, __pyx_n_s_n, __pyx_n_s_thetaR, __pyx_n_s_thetaSR, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_nDOF_trial_element, __pyx_n_s_u_l2g, __pyx_n_s_u_dof, __pyx_n_s_q_x, __pyx_n_s_q_u, __pyx_n_s_q_mass, __pyx_n_s_q_dmass, __pyx_n_s_q_r, __pyx_n_s_q_kr, __pyx_n_s_q_dkr, __pyx_n_s_q_kr_up, __pyx_n_s_q, __pyx_n_s_psiC, __pyx_n_s_pcBar, __pyx_n_s_pcBar_n, __pyx_n_s_pcBar_nM1, __pyx_n_s_pcBar_nM2, __pyx_n_s_onePlus_pcBar_n, __pyx_n_s_sBar, __pyx_n_s_sqrt_sBar, __pyx_n_s_DsBar_DpsiC, __pyx_n_s_thetaW, __pyx_n_s_DthetaW_DpsiC, __pyx_n_s_vBar, __pyx_n_s_vBar2, __pyx_n_s_DvBar_DpsiC, __pyx_n_s_KWr, __pyx_n_s_DKWr_DpsiC, __pyx_n_s_rho2, __pyx_n_s_thetaS, __pyx_n_s_rhom, __pyx_n_s_drhom, __pyx_n_s_m, __pyx_n_s_u_j, __pyx_n_s_u_eN, __pyx_n_s_u_neig, __pyx_n_s_kr_eN, __pyx_n_s_kr_neig, __pyx_n_s_phi_eN, __pyx_n_s_phi_neig, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ebN, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_j, __pyx_n_s_matID, __pyx_n_s_nAvgWeight); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 359, __pyx_L1_error)
24249  __Pyx_GOTREF(__pyx_tuple__39);
24250  __Pyx_GIVEREF(__pyx_tuple__39);
24251  __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(24, 0, 61, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_RE_NCP1_evaluateElementCoefficie_2, 359, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 359, __pyx_L1_error)
24252 
24253  /* "subsurfaceTransportFunctions.pyx":486
24254  * #eN for upwind
24255  *
24256  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
24257  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
24258  * numpy.ndarray[ITYPE_t,ndim=1] colind,
24259  */
24260  __pyx_tuple__41 = PyTuple_Pack(42, __pyx_n_s_gravity, __pyx_n_s_rowptr, __pyx_n_s_colind, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_nDOF_test_element, __pyx_n_s_q_u, __pyx_n_s_q_grad_u, __pyx_n_s_q_grad_w, __pyx_n_s_q_detJ, __pyx_n_s_q_m, __pyx_n_s_q_mt, __pyx_n_s_q_r, __pyx_n_s_q_kr, __pyx_n_s_q_kr_up, __pyx_n_s_q_flin, __pyx_n_s_q_alin, __pyx_n_s_elementResidual, __pyx_n_s_upwindFlag, __pyx_n_s_q, __pyx_n_s_nnz, __pyx_n_s_u_eN, __pyx_n_s_kr_eN, __pyx_n_s_phi_eN, __pyx_n_s_u_neig, __pyx_n_s_kr_neig, __pyx_n_s_phi_neig, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_i, __pyx_n_s_ebN, __pyx_n_s_a_up, __pyx_n_s_f_up, __pyx_n_s_nAvgWeight, __pyx_n_s_weight, __pyx_n_s_volFactor, __pyx_n_s_volume); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 486, __pyx_L1_error)
24261  __Pyx_GOTREF(__pyx_tuple__41);
24262  __Pyx_GIVEREF(__pyx_tuple__41);
24263  __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(21, 0, 42, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_RE_NCP1_getElementResidual, 486, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 486, __pyx_L1_error)
24264 
24265  /* "subsurfaceTransportFunctions.pyx":574
24266  * #i
24267  * #eN
24268  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
24269  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
24270  * numpy.ndarray[ITYPE_t,ndim=1] colind,
24271  */
24272  __pyx_tuple__43 = PyTuple_Pack(51, __pyx_n_s_gravity, __pyx_n_s_rowptr, __pyx_n_s_colind, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_nDOF_test_element, __pyx_n_s_nDOF_trial_element, __pyx_n_s_q_u, __pyx_n_s_q_grad_u, __pyx_n_s_q_grad_w, __pyx_n_s_q_grad_v, __pyx_n_s_q_detJ, __pyx_n_s_q_m, __pyx_n_s_q_dm, __pyx_n_s_q_mt, __pyx_n_s_q_dmt, __pyx_n_s_q_r, __pyx_n_s_q_kr, __pyx_n_s_q_dkr, __pyx_n_s_q_kr_up, __pyx_n_s_q_flin, __pyx_n_s_q_alin, __pyx_n_s_elementJacobian, __pyx_n_s_upwindFlag, __pyx_n_s_picard, __pyx_n_s_q, __pyx_n_s_nnz, __pyx_n_s_u_eN, __pyx_n_s_kr_eN, __pyx_n_s_phi_eN, __pyx_n_s_u_neig, __pyx_n_s_kr_neig, __pyx_n_s_phi_neig, __pyx_n_s_dkr_up, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_a_up, __pyx_n_s_f_up, __pyx_n_s_nAvgWeight, __pyx_n_s_weight, __pyx_n_s_volFactor, __pyx_n_s_thisElementIsUpwind, __pyx_n_s_volume, __pyx_n_s_i, __pyx_n_s_ebN, __pyx_n_s_j); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 574, __pyx_L1_error)
24273  __Pyx_GOTREF(__pyx_tuple__43);
24274  __Pyx_GIVEREF(__pyx_tuple__43);
24275  __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(26, 0, 51, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_RE_NCP1_getElementJacobian, 574, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 574, __pyx_L1_error)
24276 
24277  /* "subsurfaceTransportFunctions.pyx":673
24278  * ##################################################
24279  *
24280  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
24281  * numpy.ndarray[DTYPE_t,ndim=3] w,
24282  * numpy.ndarray[DTYPE_t,ndim=2] dV,
24283  */
24284  __pyx_tuple__45 = PyTuple_Pack(9, __pyx_n_s_mt, __pyx_n_s_w, __pyx_n_s_dV, __pyx_n_s_weak_residual, __pyx_n_s_eN, __pyx_n_s_i, __pyx_n_s_k, __pyx_n_s_mt_avg, __pyx_n_s_vol); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 673, __pyx_L1_error)
24285  __Pyx_GOTREF(__pyx_tuple__45);
24286  __Pyx_GIVEREF(__pyx_tuple__45);
24287  __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_updateMass_weakAvg, 673, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 673, __pyx_L1_error)
24288 
24289  /* "subsurfaceTransportFunctions.pyx":692
24290  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
24291  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
24292  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
24293  * numpy.ndarray[DTYPE_t,ndim=3] w,
24294  * numpy.ndarray[DTYPE_t,ndim=3] v,
24295  */
24296  __pyx_tuple__47 = PyTuple_Pack(11, __pyx_n_s_dmt, __pyx_n_s_w, __pyx_n_s_v, __pyx_n_s_dV, __pyx_n_s_jacobian_weak_residual, __pyx_n_s_eN, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_dmtj_avg, __pyx_n_s_vol); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 692, __pyx_L1_error)
24297  __Pyx_GOTREF(__pyx_tuple__47);
24298  __Pyx_GIVEREF(__pyx_tuple__47);
24299  __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(5, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_updateMassJacobian_weakAvg, 692, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 692, __pyx_L1_error)
24300 
24301  /* "subsurfaceTransportFunctions.pyx":717
24302  * #ELLAM
24303  * ########################################################################
24304  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
24305  * numpy.ndarray[DTYPE_t,ndim=4] n,
24306  * numpy.ndarray[DTYPE_t,ndim=3] dS,
24307  */
24308  __pyx_tuple__49 = PyTuple_Pack(9, __pyx_n_s_v, __pyx_n_s_n, __pyx_n_s_dS, __pyx_n_s_flux, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_kb, __pyx_n_s_integral, __pyx_n_s_I); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 717, __pyx_L1_error)
24309  __Pyx_GOTREF(__pyx_tuple__49);
24310  __Pyx_GIVEREF(__pyx_tuple__49);
24311  __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_calculateNormalFlux, 717, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 717, __pyx_L1_error)
24312 
24313  /* "subsurfaceTransportFunctions.pyx":732
24314  * flux[eN,ebN] = integral
24315  *
24316  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
24317  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
24318  * numpy.ndarray[DTYPE_t,ndim=2] dm,
24319  */
24320  __pyx_tuple__51 = PyTuple_Pack(9, __pyx_n_s_df, __pyx_n_s_characteristic_velocity, __pyx_n_s_dm, __pyx_n_s_dV, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_I, __pyx_n_s_omega_e, __pyx_n_s_vol_e); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 732, __pyx_L1_error)
24321  __Pyx_GOTREF(__pyx_tuple__51);
24322  __Pyx_GIVEREF(__pyx_tuple__51);
24323  __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_computeSimpleCharacteristicVeloc, 732, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(0, 732, __pyx_L1_error)
24324 
24325  /* "subsurfaceTransportFunctions.pyx":753
24326  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
24327  *
24328  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
24329  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
24330  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
24331  */
24332  __pyx_tuple__53 = PyTuple_Pack(11, __pyx_n_s_df_dofs, __pyx_n_s_characteristic_velocity_dofs, __pyx_n_s_l2g, __pyx_n_s_dm, __pyx_n_s_dV, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_j, __pyx_n_s_J, __pyx_n_s_omega_e, __pyx_n_s_vol_e); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 753, __pyx_L1_error)
24333  __Pyx_GOTREF(__pyx_tuple__53);
24334  __Pyx_GIVEREF(__pyx_tuple__53);
24335  __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(5, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_computeSimpleCharacteristicVeloc_2, 753, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(0, 753, __pyx_L1_error)
24336 
24337  /* "subsurfaceTransportFunctions.pyx":776
24338  *
24339  * #problem specific velocity evaluation
24340  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
24341  * double t,
24342  * double tForReversal,
24343  */
24344  __pyx_tuple__55 = PyTuple_Pack(12, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_zvelocity, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 776, __pyx_L1_error)
24345  __Pyx_GOTREF(__pyx_tuple__55);
24346  __Pyx_GIVEREF(__pyx_tuple__55);
24347  __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(9, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_rotatingGaussianElementVelocityE, 776, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(0, 776, __pyx_L1_error)
24348 
24349  /* "subsurfaceTransportFunctions.pyx":816
24350  *
24351  *
24352  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
24353  * double t,
24354  * double tForReversal,
24355  */
24356  __pyx_tuple__57 = PyTuple_Pack(13, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_zvelocity, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 816, __pyx_L1_error)
24357  __Pyx_GOTREF(__pyx_tuple__57);
24358  __Pyx_GIVEREF(__pyx_tuple__57);
24359  __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(9, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_rotatingGaussianElementVelocityE_2, 816, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(0, 816, __pyx_L1_error)
24360 
24361  /* "subsurfaceTransportFunctions.pyx":859
24362  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
24363  *
24364  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
24365  * double t,
24366  * double tForReversal,
24367  */
24368  __pyx_tuple__59 = PyTuple_Pack(12, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_zVelocity, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(0, 859, __pyx_L1_error)
24369  __Pyx_GOTREF(__pyx_tuple__59);
24370  __Pyx_GIVEREF(__pyx_tuple__59);
24371  __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(9, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_helicalElementVelocityEval3, 859, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(0, 859, __pyx_L1_error)
24372 
24373  /* "subsurfaceTransportFunctions.pyx":884
24374  * v[eN,k,2]=zVelocity
24375  *
24376  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
24377  * double t,
24378  * double tForReversal,
24379  */
24380  __pyx_tuple__61 = PyTuple_Pack(13, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_zVelocity, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(0, 884, __pyx_L1_error)
24381  __Pyx_GOTREF(__pyx_tuple__61);
24382  __Pyx_GIVEREF(__pyx_tuple__61);
24383  __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(9, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_helicalElementVelocityEval4, 884, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(0, 884, __pyx_L1_error)
24384 
24385  /* "subsurfaceTransportFunctions.pyx":911
24386  * v[eN,ebN,k,2]=zVelocity
24387  *
24388  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
24389  * numpy.ndarray[DTYPE_t,ndim=3] x,
24390  * numpy.ndarray[DTYPE_t,ndim=3] v):
24391  */
24392  __pyx_tuple__63 = PyTuple_Pack(7, __pyx_n_s_t, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_pi, __pyx_n_s_one8); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(0, 911, __pyx_L1_error)
24393  __Pyx_GOTREF(__pyx_tuple__63);
24394  __Pyx_GIVEREF(__pyx_tuple__63);
24395  __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_vortexElementVelocityEval3, 911, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(0, 911, __pyx_L1_error)
24396 
24397  /* "subsurfaceTransportFunctions.pyx":924
24398  *
24399  *
24400  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
24401  * numpy.ndarray[DTYPE_t,ndim=4] x,
24402  * numpy.ndarray[DTYPE_t,ndim=4] v):
24403  */
24404  __pyx_tuple__65 = PyTuple_Pack(8, __pyx_n_s_t, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_ebN, __pyx_n_s_pi, __pyx_n_s_one8); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(0, 924, __pyx_L1_error)
24405  __Pyx_GOTREF(__pyx_tuple__65);
24406  __Pyx_GIVEREF(__pyx_tuple__65);
24407  __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_vortexElementVelocityEval4, 924, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) __PYX_ERR(0, 924, __pyx_L1_error)
24408  __Pyx_RefNannyFinishContext();
24409  return 0;
24410  __pyx_L1_error:;
24411  __Pyx_RefNannyFinishContext();
24412  return -1;
24413 }
24414 
24415 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
24416  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
24417  __pyx_float_0_0 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_float_0_0)) __PYX_ERR(0, 1, __pyx_L1_error)
24418  __pyx_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_float_0_5)) __PYX_ERR(0, 1, __pyx_L1_error)
24419  __pyx_float_2_0 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_float_2_0)) __PYX_ERR(0, 1, __pyx_L1_error)
24420  __pyx_float_1_0eneg_20 = PyFloat_FromDouble(1.0e-20); if (unlikely(!__pyx_float_1_0eneg_20)) __PYX_ERR(0, 1, __pyx_L1_error)
24421  return 0;
24422  __pyx_L1_error:;
24423  return -1;
24424 }
24425 
24426 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
24427 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
24428 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
24429 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
24430 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
24431 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
24432 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
24433 
24434 static int __Pyx_modinit_global_init_code(void) {
24435  __Pyx_RefNannyDeclarations
24436  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
24437  /*--- Global init code ---*/
24438  __Pyx_RefNannyFinishContext();
24439  return 0;
24440 }
24441 
24442 static int __Pyx_modinit_variable_export_code(void) {
24443  __Pyx_RefNannyDeclarations
24444  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
24445  /*--- Variable export code ---*/
24446  __Pyx_RefNannyFinishContext();
24447  return 0;
24448 }
24449 
24450 static int __Pyx_modinit_function_export_code(void) {
24451  __Pyx_RefNannyDeclarations
24452  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
24453  /*--- Function export code ---*/
24454  __Pyx_RefNannyFinishContext();
24455  return 0;
24456 }
24457 
24458 static int __Pyx_modinit_type_init_code(void) {
24459  __Pyx_RefNannyDeclarations
24460  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
24461  /*--- Type init code ---*/
24462  __Pyx_RefNannyFinishContext();
24463  return 0;
24464 }
24465 
24466 static int __Pyx_modinit_type_import_code(void) {
24467  __Pyx_RefNannyDeclarations
24468  PyObject *__pyx_t_1 = NULL;
24469  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
24470  /*--- Type import code ---*/
24471  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
24472  __Pyx_GOTREF(__pyx_t_1);
24473  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
24474  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
24475  sizeof(PyTypeObject),
24476  #else
24477  sizeof(PyHeapTypeObject),
24478  #endif
24479  __Pyx_ImportType_CheckSize_Warn);
24480  if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error)
24481  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24482  __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 206, __pyx_L1_error)
24483  __Pyx_GOTREF(__pyx_t_1);
24484  __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
24485  if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 206, __pyx_L1_error)
24486  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Warn);
24487  if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 229, __pyx_L1_error)
24488  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Warn);
24489  if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 233, __pyx_L1_error)
24490  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
24491  if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 242, __pyx_L1_error)
24492  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Warn);
24493  if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 918, __pyx_L1_error)
24494  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24495  __Pyx_RefNannyFinishContext();
24496  return 0;
24497  __pyx_L1_error:;
24498  __Pyx_XDECREF(__pyx_t_1);
24499  __Pyx_RefNannyFinishContext();
24500  return -1;
24501 }
24502 
24503 static int __Pyx_modinit_variable_import_code(void) {
24504  __Pyx_RefNannyDeclarations
24505  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
24506  /*--- Variable import code ---*/
24507  __Pyx_RefNannyFinishContext();
24508  return 0;
24509 }
24510 
24511 static int __Pyx_modinit_function_import_code(void) {
24512  __Pyx_RefNannyDeclarations
24513  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
24514  /*--- Function import code ---*/
24515  __Pyx_RefNannyFinishContext();
24516  return 0;
24517 }
24518 
24519 
24520 #if PY_MAJOR_VERSION < 3
24521 #ifdef CYTHON_NO_PYINIT_EXPORT
24522 #define __Pyx_PyMODINIT_FUNC void
24523 #else
24524 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
24525 #endif
24526 #else
24527 #ifdef CYTHON_NO_PYINIT_EXPORT
24528 #define __Pyx_PyMODINIT_FUNC PyObject *
24529 #else
24530 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
24531 #endif
24532 #endif
24533 
24534 
24535 #if PY_MAJOR_VERSION < 3
24536 __Pyx_PyMODINIT_FUNC initsubsurfaceTransportFunctions(void) CYTHON_SMALL_CODE; /*proto*/
24537 __Pyx_PyMODINIT_FUNC initsubsurfaceTransportFunctions(void)
24538 #else
24539 __Pyx_PyMODINIT_FUNC PyInit_subsurfaceTransportFunctions(void) CYTHON_SMALL_CODE; /*proto*/
24540 __Pyx_PyMODINIT_FUNC PyInit_subsurfaceTransportFunctions(void)
24541 #if CYTHON_PEP489_MULTI_PHASE_INIT
24542 {
24543  return PyModuleDef_Init(&__pyx_moduledef);
24544 }
24545 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
24546  #if PY_VERSION_HEX >= 0x030700A1
24547  static PY_INT64_T main_interpreter_id = -1;
24548  PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
24549  if (main_interpreter_id == -1) {
24550  main_interpreter_id = current_id;
24551  return (unlikely(current_id == -1)) ? -1 : 0;
24552  } else if (unlikely(main_interpreter_id != current_id))
24553  #else
24554  static PyInterpreterState *main_interpreter = NULL;
24555  PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
24556  if (!main_interpreter) {
24557  main_interpreter = current_interpreter;
24558  } else if (unlikely(main_interpreter != current_interpreter))
24559  #endif
24560  {
24561  PyErr_SetString(
24562  PyExc_ImportError,
24563  "Interpreter change detected - this module can only be loaded into one interpreter per process.");
24564  return -1;
24565  }
24566  return 0;
24567 }
24568 static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
24569  PyObject *value = PyObject_GetAttrString(spec, from_name);
24570  int result = 0;
24571  if (likely(value)) {
24572  if (allow_none || value != Py_None) {
24573  result = PyDict_SetItemString(moddict, to_name, value);
24574  }
24575  Py_DECREF(value);
24576  } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
24577  PyErr_Clear();
24578  } else {
24579  result = -1;
24580  }
24581  return result;
24582 }
24583 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
24584  PyObject *module = NULL, *moddict, *modname;
24585  if (__Pyx_check_single_interpreter())
24586  return NULL;
24587  if (__pyx_m)
24588  return __Pyx_NewRef(__pyx_m);
24589  modname = PyObject_GetAttrString(spec, "name");
24590  if (unlikely(!modname)) goto bad;
24591  module = PyModule_NewObject(modname);
24592  Py_DECREF(modname);
24593  if (unlikely(!module)) goto bad;
24594  moddict = PyModule_GetDict(module);
24595  if (unlikely(!moddict)) goto bad;
24596  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
24597  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
24598  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
24599  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
24600  return module;
24601 bad:
24602  Py_XDECREF(module);
24603  return NULL;
24604 }
24605 
24606 
24607 static CYTHON_SMALL_CODE int __pyx_pymod_exec_subsurfaceTransportFunctions(PyObject *__pyx_pyinit_module)
24608 #endif
24609 #endif
24610 {
24611  PyObject *__pyx_t_1 = NULL;
24612  __Pyx_RefNannyDeclarations
24613  #if CYTHON_PEP489_MULTI_PHASE_INIT
24614  if (__pyx_m) {
24615  if (__pyx_m == __pyx_pyinit_module) return 0;
24616  PyErr_SetString(PyExc_RuntimeError, "Module 'subsurfaceTransportFunctions' has already been imported. Re-initialisation is not supported.");
24617  return -1;
24618  }
24619  #elif PY_MAJOR_VERSION >= 3
24620  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
24621  #endif
24622  #if CYTHON_REFNANNY
24623 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
24624 if (!__Pyx_RefNanny) {
24625  PyErr_Clear();
24626  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
24627  if (!__Pyx_RefNanny)
24628  Py_FatalError("failed to import 'refnanny' module");
24629 }
24630 #endif
24631  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_subsurfaceTransportFunctions(void)", 0);
24632  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24633  #ifdef __Pxy_PyFrame_Initialize_Offsets
24634  __Pxy_PyFrame_Initialize_Offsets();
24635  #endif
24636  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
24637  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
24638  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
24639  #ifdef __Pyx_CyFunction_USED
24640  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24641  #endif
24642  #ifdef __Pyx_FusedFunction_USED
24643  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24644  #endif
24645  #ifdef __Pyx_Coroutine_USED
24646  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24647  #endif
24648  #ifdef __Pyx_Generator_USED
24649  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24650  #endif
24651  #ifdef __Pyx_AsyncGen_USED
24652  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24653  #endif
24654  #ifdef __Pyx_StopAsyncIteration_USED
24655  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24656  #endif
24657  /*--- Library function declarations ---*/
24658  /*--- Threads initialization code ---*/
24659  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
24660  #ifdef WITH_THREAD /* Python build with threading support? */
24661  PyEval_InitThreads();
24662  #endif
24663  #endif
24664  /*--- Module creation code ---*/
24665  #if CYTHON_PEP489_MULTI_PHASE_INIT
24666  __pyx_m = __pyx_pyinit_module;
24667  Py_INCREF(__pyx_m);
24668  #else
24669  #if PY_MAJOR_VERSION < 3
24670  __pyx_m = Py_InitModule4("subsurfaceTransportFunctions", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
24671  #else
24672  __pyx_m = PyModule_Create(&__pyx_moduledef);
24673  #endif
24674  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
24675  #endif
24676  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
24677  Py_INCREF(__pyx_d);
24678  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
24679  Py_INCREF(__pyx_b);
24680  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
24681  Py_INCREF(__pyx_cython_runtime);
24682  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
24683  /*--- Initialize various global constants etc. ---*/
24684  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24685  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
24686  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24687  #endif
24688  if (__pyx_module_is_main_subsurfaceTransportFunctions) {
24689  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24690  }
24691  #if PY_MAJOR_VERSION >= 3
24692  {
24693  PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
24694  if (!PyDict_GetItemString(modules, "subsurfaceTransportFunctions")) {
24695  if (unlikely(PyDict_SetItemString(modules, "subsurfaceTransportFunctions", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
24696  }
24697  }
24698  #endif
24699  /*--- Builtin init code ---*/
24700  if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error;
24701  /*--- Constants init code ---*/
24702  if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error;
24703  /*--- Global type/function init code ---*/
24704  (void)__Pyx_modinit_global_init_code();
24705  (void)__Pyx_modinit_variable_export_code();
24706  (void)__Pyx_modinit_function_export_code();
24707  (void)__Pyx_modinit_type_init_code();
24708  if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
24709  (void)__Pyx_modinit_variable_import_code();
24710  (void)__Pyx_modinit_function_import_code();
24711  /*--- Execution code ---*/
24712  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
24713  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24714  #endif
24715 
24716  /* "subsurfaceTransportFunctions.pyx":1
24717  * import numpy # <<<<<<<<<<<<<<
24718  * cimport numpy
24719  * cdef extern from "math.h":
24720  */
24721  __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
24722  __Pyx_GOTREF(__pyx_t_1);
24723  if (PyDict_SetItem(__pyx_d, __pyx_n_s_numpy, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24724  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24725 
24726  /* "subsurfaceTransportFunctions.pyx":18
24727  * ctypedef int ITYPE_t
24728  *
24729  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
24730  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
24731  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
24732  */
24733  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
24734  __Pyx_GOTREF(__pyx_t_1);
24735  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setExteriorElementBoundaryTypes, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
24736  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24737 
24738  /* "subsurfaceTransportFunctions.pyx":29
24739  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
24740  *
24741  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
24742  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
24743  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
24744  */
24745  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_3setElementBoundariesArray, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
24746  __Pyx_GOTREF(__pyx_t_1);
24747  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setElementBoundariesArray, __pyx_t_1) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
24748  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24749 
24750  /* "subsurfaceTransportFunctions.pyx":43
24751  *
24752  * ###
24753  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
24754  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
24755  * dict material_functions):
24756  */
24757  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
24758  __Pyx_GOTREF(__pyx_t_1);
24759  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setScalarMaterialFunctionOverEle, __pyx_t_1) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
24760  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24761 
24762  /* "subsurfaceTransportFunctions.pyx":56
24763  * q_vals[eN,k] = material_functions[material]
24764  *
24765  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
24766  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
24767  * dict material_functions):
24768  */
24769  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error)
24770  __Pyx_GOTREF(__pyx_t_1);
24771  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setVectorMaterialFunctionOverEle, __pyx_t_1) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
24772  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24773 
24774  /* "subsurfaceTransportFunctions.pyx":69
24775  *
24776  *
24777  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
24778  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24779  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
24780  */
24781  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error)
24782  __Pyx_GOTREF(__pyx_t_1);
24783  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setScalarMaterialFunctionOverEle_2, __pyx_t_1) < 0) __PYX_ERR(0, 69, __pyx_L1_error)
24784  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24785 
24786  /* "subsurfaceTransportFunctions.pyx":91
24787  * material_functions[material_right])
24788  *
24789  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
24790  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24791  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24792  */
24793  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
24794  __Pyx_GOTREF(__pyx_t_1);
24795  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setSparseTensorMaterialFunctionO, __pyx_t_1) < 0) __PYX_ERR(0, 91, __pyx_L1_error)
24796  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24797 
24798  /* "subsurfaceTransportFunctions.pyx":118
24799  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
24800  *
24801  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
24802  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24803  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
24804  */
24805  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error)
24806  __Pyx_GOTREF(__pyx_t_1);
24807  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setScalarMaterialFunctionOverGlo, __pyx_t_1) < 0) __PYX_ERR(0, 118, __pyx_L1_error)
24808  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24809 
24810  /* "subsurfaceTransportFunctions.pyx":139
24811  *
24812  *
24813  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
24814  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24815  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24816  */
24817  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error)
24818  __Pyx_GOTREF(__pyx_t_1);
24819  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setSparseTensorMaterialFunctionO_2, __pyx_t_1) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
24820  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24821 
24822  /* "subsurfaceTransportFunctions.pyx":165
24823  *
24824  * ###
24825  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
24826  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
24827  * numpy.ndarray[DTYPE_t,ndim=3] x,
24828  */
24829  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error)
24830  __Pyx_GOTREF(__pyx_t_1);
24831  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateScalarMaterialFunctionOv, __pyx_t_1) < 0) __PYX_ERR(0, 165, __pyx_L1_error)
24832  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24833 
24834  /* "subsurfaceTransportFunctions.pyx":180
24835  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
24836  *
24837  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
24838  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
24839  * numpy.ndarray[DTYPE_t,ndim=3] x,
24840  */
24841  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
24842  __Pyx_GOTREF(__pyx_t_1);
24843  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateVectorMaterialFunctionOv, __pyx_t_1) < 0) __PYX_ERR(0, 180, __pyx_L1_error)
24844  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24845 
24846  /* "subsurfaceTransportFunctions.pyx":195
24847  *
24848  *
24849  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
24850  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24851  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24852  */
24853  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __pyx_L1_error)
24854  __Pyx_GOTREF(__pyx_t_1);
24855  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateScalarMaterialFunctionOv_2, __pyx_t_1) < 0) __PYX_ERR(0, 195, __pyx_L1_error)
24856  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24857 
24858  /* "subsurfaceTransportFunctions.pyx":219
24859  * material_functions[material_right](x[eN,ebN_local,k],t))
24860  *
24861  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
24862  * double t,
24863  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24864  */
24865  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error)
24866  __Pyx_GOTREF(__pyx_t_1);
24867  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateSparseTensorMaterialFunc, __pyx_t_1) < 0) __PYX_ERR(0, 219, __pyx_L1_error)
24868  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24869 
24870  /* "subsurfaceTransportFunctions.pyx":248
24871  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
24872  *
24873  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
24874  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24875  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24876  */
24877  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error)
24878  __Pyx_GOTREF(__pyx_t_1);
24879  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateScalarMaterialFunctionOv_3, __pyx_t_1) < 0) __PYX_ERR(0, 248, __pyx_L1_error)
24880  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24881 
24882  /* "subsurfaceTransportFunctions.pyx":271
24883  *
24884  *
24885  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
24886  * double t,
24887  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24888  */
24889  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 271, __pyx_L1_error)
24890  __Pyx_GOTREF(__pyx_t_1);
24891  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateSparseTensorMaterialFunc_2, __pyx_t_1) < 0) __PYX_ERR(0, 271, __pyx_L1_error)
24892  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24893 
24894  /* "subsurfaceTransportFunctions.pyx":301
24895  *
24896  * ##################################################
24897  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
24898  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
24899  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
24900  */
24901  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error)
24902  __Pyx_GOTREF(__pyx_t_1);
24903  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_evaluateElementCoefficie, __pyx_t_1) < 0) __PYX_ERR(0, 301, __pyx_L1_error)
24904  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24905 
24906  /* "subsurfaceTransportFunctions.pyx":359
24907  *
24908  *
24909  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
24910  * double beta,
24911  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
24912  */
24913  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 359, __pyx_L1_error)
24914  __Pyx_GOTREF(__pyx_t_1);
24915  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_evaluateElementCoefficie_2, __pyx_t_1) < 0) __PYX_ERR(0, 359, __pyx_L1_error)
24916  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24917 
24918  /* "subsurfaceTransportFunctions.pyx":486
24919  * #eN for upwind
24920  *
24921  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
24922  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
24923  * numpy.ndarray[ITYPE_t,ndim=1] colind,
24924  */
24925  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error)
24926  __Pyx_GOTREF(__pyx_t_1);
24927  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_getElementResidual, __pyx_t_1) < 0) __PYX_ERR(0, 486, __pyx_L1_error)
24928  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24929 
24930  /* "subsurfaceTransportFunctions.pyx":574
24931  * #i
24932  * #eN
24933  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
24934  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
24935  * numpy.ndarray[ITYPE_t,ndim=1] colind,
24936  */
24937  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error)
24938  __Pyx_GOTREF(__pyx_t_1);
24939  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_getElementJacobian, __pyx_t_1) < 0) __PYX_ERR(0, 574, __pyx_L1_error)
24940  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24941 
24942  /* "subsurfaceTransportFunctions.pyx":673
24943  * ##################################################
24944  *
24945  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
24946  * numpy.ndarray[DTYPE_t,ndim=3] w,
24947  * numpy.ndarray[DTYPE_t,ndim=2] dV,
24948  */
24949  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_37updateMass_weakAvg, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 673, __pyx_L1_error)
24950  __Pyx_GOTREF(__pyx_t_1);
24951  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateMass_weakAvg, __pyx_t_1) < 0) __PYX_ERR(0, 673, __pyx_L1_error)
24952  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24953 
24954  /* "subsurfaceTransportFunctions.pyx":692
24955  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
24956  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
24957  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
24958  * numpy.ndarray[DTYPE_t,ndim=3] w,
24959  * numpy.ndarray[DTYPE_t,ndim=3] v,
24960  */
24961  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 692, __pyx_L1_error)
24962  __Pyx_GOTREF(__pyx_t_1);
24963  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateMassJacobian_weakAvg, __pyx_t_1) < 0) __PYX_ERR(0, 692, __pyx_L1_error)
24964  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24965 
24966  /* "subsurfaceTransportFunctions.pyx":717
24967  * #ELLAM
24968  * ########################################################################
24969  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
24970  * numpy.ndarray[DTYPE_t,ndim=4] n,
24971  * numpy.ndarray[DTYPE_t,ndim=3] dS,
24972  */
24973  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_41calculateNormalFlux, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L1_error)
24974  __Pyx_GOTREF(__pyx_t_1);
24975  if (PyDict_SetItem(__pyx_d, __pyx_n_s_calculateNormalFlux, __pyx_t_1) < 0) __PYX_ERR(0, 717, __pyx_L1_error)
24976  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24977 
24978  /* "subsurfaceTransportFunctions.pyx":732
24979  * flux[eN,ebN] = integral
24980  *
24981  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
24982  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
24983  * numpy.ndarray[DTYPE_t,ndim=2] dm,
24984  */
24985  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 732, __pyx_L1_error)
24986  __Pyx_GOTREF(__pyx_t_1);
24987  if (PyDict_SetItem(__pyx_d, __pyx_n_s_computeSimpleCharacteristicVeloc, __pyx_t_1) < 0) __PYX_ERR(0, 732, __pyx_L1_error)
24988  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24989 
24990  /* "subsurfaceTransportFunctions.pyx":753
24991  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
24992  *
24993  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
24994  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
24995  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
24996  */
24997  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 753, __pyx_L1_error)
24998  __Pyx_GOTREF(__pyx_t_1);
24999  if (PyDict_SetItem(__pyx_d, __pyx_n_s_computeSimpleCharacteristicVeloc_2, __pyx_t_1) < 0) __PYX_ERR(0, 753, __pyx_L1_error)
25000  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25001 
25002  /* "subsurfaceTransportFunctions.pyx":776
25003  *
25004  * #problem specific velocity evaluation
25005  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
25006  * double t,
25007  * double tForReversal,
25008  */
25009  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error)
25010  __Pyx_GOTREF(__pyx_t_1);
25011  if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotatingGaussianElementVelocityE, __pyx_t_1) < 0) __PYX_ERR(0, 776, __pyx_L1_error)
25012  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25013 
25014  /* "subsurfaceTransportFunctions.pyx":816
25015  *
25016  *
25017  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
25018  * double t,
25019  * double tForReversal,
25020  */
25021  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 816, __pyx_L1_error)
25022  __Pyx_GOTREF(__pyx_t_1);
25023  if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotatingGaussianElementVelocityE_2, __pyx_t_1) < 0) __PYX_ERR(0, 816, __pyx_L1_error)
25024  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25025 
25026  /* "subsurfaceTransportFunctions.pyx":859
25027  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
25028  *
25029  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
25030  * double t,
25031  * double tForReversal,
25032  */
25033  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_51helicalElementVelocityEval3, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 859, __pyx_L1_error)
25034  __Pyx_GOTREF(__pyx_t_1);
25035  if (PyDict_SetItem(__pyx_d, __pyx_n_s_helicalElementVelocityEval3, __pyx_t_1) < 0) __PYX_ERR(0, 859, __pyx_L1_error)
25036  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25037 
25038  /* "subsurfaceTransportFunctions.pyx":884
25039  * v[eN,k,2]=zVelocity
25040  *
25041  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
25042  * double t,
25043  * double tForReversal,
25044  */
25045  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_53helicalElementVelocityEval4, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 884, __pyx_L1_error)
25046  __Pyx_GOTREF(__pyx_t_1);
25047  if (PyDict_SetItem(__pyx_d, __pyx_n_s_helicalElementVelocityEval4, __pyx_t_1) < 0) __PYX_ERR(0, 884, __pyx_L1_error)
25048  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25049 
25050  /* "subsurfaceTransportFunctions.pyx":911
25051  * v[eN,ebN,k,2]=zVelocity
25052  *
25053  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
25054  * numpy.ndarray[DTYPE_t,ndim=3] x,
25055  * numpy.ndarray[DTYPE_t,ndim=3] v):
25056  */
25057  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_55vortexElementVelocityEval3, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 911, __pyx_L1_error)
25058  __Pyx_GOTREF(__pyx_t_1);
25059  if (PyDict_SetItem(__pyx_d, __pyx_n_s_vortexElementVelocityEval3, __pyx_t_1) < 0) __PYX_ERR(0, 911, __pyx_L1_error)
25060  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25061 
25062  /* "subsurfaceTransportFunctions.pyx":924
25063  *
25064  *
25065  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
25066  * numpy.ndarray[DTYPE_t,ndim=4] x,
25067  * numpy.ndarray[DTYPE_t,ndim=4] v):
25068  */
25069  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_57vortexElementVelocityEval4, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error)
25070  __Pyx_GOTREF(__pyx_t_1);
25071  if (PyDict_SetItem(__pyx_d, __pyx_n_s_vortexElementVelocityEval4, __pyx_t_1) < 0) __PYX_ERR(0, 924, __pyx_L1_error)
25072  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25073 
25074  /* "subsurfaceTransportFunctions.pyx":1
25075  * import numpy # <<<<<<<<<<<<<<
25076  * cimport numpy
25077  * cdef extern from "math.h":
25078  */
25079  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
25080  __Pyx_GOTREF(__pyx_t_1);
25081  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25082  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25083 
25084  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1046
25085  * raise ImportError("numpy.core.umath failed to import")
25086  *
25087  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
25088  * try:
25089  * _import_umath()
25090  */
25091 
25092  /*--- Wrapped vars code ---*/
25093 
25094  goto __pyx_L0;
25095  __pyx_L1_error:;
25096  __Pyx_XDECREF(__pyx_t_1);
25097  if (__pyx_m) {
25098  if (__pyx_d) {
25099  __Pyx_AddTraceback("init subsurfaceTransportFunctions", __pyx_clineno, __pyx_lineno, __pyx_filename);
25100  }
25101  Py_CLEAR(__pyx_m);
25102  } else if (!PyErr_Occurred()) {
25103  PyErr_SetString(PyExc_ImportError, "init subsurfaceTransportFunctions");
25104  }
25105  __pyx_L0:;
25106  __Pyx_RefNannyFinishContext();
25107  #if CYTHON_PEP489_MULTI_PHASE_INIT
25108  return (__pyx_m != NULL) ? 0 : -1;
25109  #elif PY_MAJOR_VERSION >= 3
25110  return __pyx_m;
25111  #else
25112  return;
25113  #endif
25114 }
25115 
25116 /* --- Runtime support code --- */
25117 /* Refnanny */
25118 #if CYTHON_REFNANNY
25119 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
25120  PyObject *m = NULL, *p = NULL;
25121  void *r = NULL;
25122  m = PyImport_ImportModule(modname);
25123  if (!m) goto end;
25124  p = PyObject_GetAttrString(m, "RefNannyAPI");
25125  if (!p) goto end;
25126  r = PyLong_AsVoidPtr(p);
25127 end:
25128  Py_XDECREF(p);
25129  Py_XDECREF(m);
25130  return (__Pyx_RefNannyAPIStruct *)r;
25131 }
25132 #endif
25133 
25134 /* PyObjectGetAttrStr */
25135 #if CYTHON_USE_TYPE_SLOTS
25136 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
25137  PyTypeObject* tp = Py_TYPE(obj);
25138  if (likely(tp->tp_getattro))
25139  return tp->tp_getattro(obj, attr_name);
25140 #if PY_MAJOR_VERSION < 3
25141  if (likely(tp->tp_getattr))
25142  return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
25143 #endif
25144  return PyObject_GetAttr(obj, attr_name);
25145 }
25146 #endif
25147 
25148 /* GetBuiltinName */
25149 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
25150  PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
25151  if (unlikely(!result)) {
25152  PyErr_Format(PyExc_NameError,
25153 #if PY_MAJOR_VERSION >= 3
25154  "name '%U' is not defined", name);
25155 #else
25156  "name '%.200s' is not defined", PyString_AS_STRING(name));
25157 #endif
25158  }
25159  return result;
25160 }
25161 
25162 /* RaiseArgTupleInvalid */
25163 static void __Pyx_RaiseArgtupleInvalid(
25164  const char* func_name,
25165  int exact,
25166  Py_ssize_t num_min,
25167  Py_ssize_t num_max,
25168  Py_ssize_t num_found)
25169 {
25170  Py_ssize_t num_expected;
25171  const char *more_or_less;
25172  if (num_found < num_min) {
25173  num_expected = num_min;
25174  more_or_less = "at least";
25175  } else {
25176  num_expected = num_max;
25177  more_or_less = "at most";
25178  }
25179  if (exact) {
25180  more_or_less = "exactly";
25181  }
25182  PyErr_Format(PyExc_TypeError,
25183  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
25184  func_name, more_or_less, num_expected,
25185  (num_expected == 1) ? "" : "s", num_found);
25186 }
25187 
25188 /* RaiseDoubleKeywords */
25189 static void __Pyx_RaiseDoubleKeywordsError(
25190  const char* func_name,
25191  PyObject* kw_name)
25192 {
25193  PyErr_Format(PyExc_TypeError,
25194  #if PY_MAJOR_VERSION >= 3
25195  "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
25196  #else
25197  "%s() got multiple values for keyword argument '%s'", func_name,
25198  PyString_AsString(kw_name));
25199  #endif
25200 }
25201 
25202 /* ParseKeywords */
25203 static int __Pyx_ParseOptionalKeywords(
25204  PyObject *kwds,
25205  PyObject **argnames[],
25206  PyObject *kwds2,
25207  PyObject *values[],
25208  Py_ssize_t num_pos_args,
25209  const char* function_name)
25210 {
25211  PyObject *key = 0, *value = 0;
25212  Py_ssize_t pos = 0;
25213  PyObject*** name;
25214  PyObject*** first_kw_arg = argnames + num_pos_args;
25215  while (PyDict_Next(kwds, &pos, &key, &value)) {
25216  name = first_kw_arg;
25217  while (*name && (**name != key)) name++;
25218  if (*name) {
25219  values[name-argnames] = value;
25220  continue;
25221  }
25222  name = first_kw_arg;
25223  #if PY_MAJOR_VERSION < 3
25224  if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
25225  while (*name) {
25226  if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
25227  && _PyString_Eq(**name, key)) {
25228  values[name-argnames] = value;
25229  break;
25230  }
25231  name++;
25232  }
25233  if (*name) continue;
25234  else {
25235  PyObject*** argname = argnames;
25236  while (argname != first_kw_arg) {
25237  if ((**argname == key) || (
25238  (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
25239  && _PyString_Eq(**argname, key))) {
25240  goto arg_passed_twice;
25241  }
25242  argname++;
25243  }
25244  }
25245  } else
25246  #endif
25247  if (likely(PyUnicode_Check(key))) {
25248  while (*name) {
25249  int cmp = (**name == key) ? 0 :
25250  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
25251  (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
25252  #endif
25253  PyUnicode_Compare(**name, key);
25254  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
25255  if (cmp == 0) {
25256  values[name-argnames] = value;
25257  break;
25258  }
25259  name++;
25260  }
25261  if (*name) continue;
25262  else {
25263  PyObject*** argname = argnames;
25264  while (argname != first_kw_arg) {
25265  int cmp = (**argname == key) ? 0 :
25266  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
25267  (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
25268  #endif
25269  PyUnicode_Compare(**argname, key);
25270  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
25271  if (cmp == 0) goto arg_passed_twice;
25272  argname++;
25273  }
25274  }
25275  } else
25276  goto invalid_keyword_type;
25277  if (kwds2) {
25278  if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
25279  } else {
25280  goto invalid_keyword;
25281  }
25282  }
25283  return 0;
25284 arg_passed_twice:
25285  __Pyx_RaiseDoubleKeywordsError(function_name, key);
25286  goto bad;
25287 invalid_keyword_type:
25288  PyErr_Format(PyExc_TypeError,
25289  "%.200s() keywords must be strings", function_name);
25290  goto bad;
25291 invalid_keyword:
25292  PyErr_Format(PyExc_TypeError,
25293  #if PY_MAJOR_VERSION < 3
25294  "%.200s() got an unexpected keyword argument '%.200s'",
25295  function_name, PyString_AsString(key));
25296  #else
25297  "%s() got an unexpected keyword argument '%U'",
25298  function_name, key);
25299  #endif
25300 bad:
25301  return -1;
25302 }
25303 
25304 /* ArgTypeTest */
25305 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
25306 {
25307  if (unlikely(!type)) {
25308  PyErr_SetString(PyExc_SystemError, "Missing type object");
25309  return 0;
25310  }
25311  else if (exact) {
25312  #if PY_MAJOR_VERSION == 2
25313  if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
25314  #endif
25315  }
25316  else {
25317  if (likely(__Pyx_TypeCheck(obj, type))) return 1;
25318  }
25319  PyErr_Format(PyExc_TypeError,
25320  "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
25321  name, type->tp_name, Py_TYPE(obj)->tp_name);
25322  return 0;
25323 }
25324 
25325 /* IsLittleEndian */
25326 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
25327 {
25328  union {
25329  uint32_t u32;
25330  uint8_t u8[4];
25331  } S;
25332  S.u32 = 0x01020304;
25333  return S.u8[0] == 4;
25334 }
25335 
25336 /* BufferFormatCheck */
25337 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
25338  __Pyx_BufFmt_StackElem* stack,
25339  __Pyx_TypeInfo* type) {
25340  stack[0].field = &ctx->root;
25341  stack[0].parent_offset = 0;
25342  ctx->root.type = type;
25343  ctx->root.name = "buffer dtype";
25344  ctx->root.offset = 0;
25345  ctx->head = stack;
25346  ctx->head->field = &ctx->root;
25347  ctx->fmt_offset = 0;
25348  ctx->head->parent_offset = 0;
25349  ctx->new_packmode = '@';
25350  ctx->enc_packmode = '@';
25351  ctx->new_count = 1;
25352  ctx->enc_count = 0;
25353  ctx->enc_type = 0;
25354  ctx->is_complex = 0;
25355  ctx->is_valid_array = 0;
25356  ctx->struct_alignment = 0;
25357  while (type->typegroup == 'S') {
25358  ++ctx->head;
25359  ctx->head->field = type->fields;
25360  ctx->head->parent_offset = 0;
25361  type = type->fields->type;
25362  }
25363 }
25364 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
25365  int count;
25366  const char* t = *ts;
25367  if (*t < '0' || *t > '9') {
25368  return -1;
25369  } else {
25370  count = *t++ - '0';
25371  while (*t >= '0' && *t <= '9') {
25372  count *= 10;
25373  count += *t++ - '0';
25374  }
25375  }
25376  *ts = t;
25377  return count;
25378 }
25379 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
25380  int number = __Pyx_BufFmt_ParseNumber(ts);
25381  if (number == -1)
25382  PyErr_Format(PyExc_ValueError,\
25383  "Does not understand character buffer dtype format string ('%c')", **ts);
25384  return number;
25385 }
25386 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
25387  PyErr_Format(PyExc_ValueError,
25388  "Unexpected format string character: '%c'", ch);
25389 }
25390 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
25391  switch (ch) {
25392  case '?': return "'bool'";
25393  case 'c': return "'char'";
25394  case 'b': return "'signed char'";
25395  case 'B': return "'unsigned char'";
25396  case 'h': return "'short'";
25397  case 'H': return "'unsigned short'";
25398  case 'i': return "'int'";
25399  case 'I': return "'unsigned int'";
25400  case 'l': return "'long'";
25401  case 'L': return "'unsigned long'";
25402  case 'q': return "'long long'";
25403  case 'Q': return "'unsigned long long'";
25404  case 'f': return (is_complex ? "'complex float'" : "'float'");
25405  case 'd': return (is_complex ? "'complex double'" : "'double'");
25406  case 'g': return (is_complex ? "'complex long double'" : "'long double'");
25407  case 'T': return "a struct";
25408  case 'O': return "Python object";
25409  case 'P': return "a pointer";
25410  case 's': case 'p': return "a string";
25411  case 0: return "end";
25412  default: return "unparseable format string";
25413  }
25414 }
25415 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
25416  switch (ch) {
25417  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
25418  case 'h': case 'H': return 2;
25419  case 'i': case 'I': case 'l': case 'L': return 4;
25420  case 'q': case 'Q': return 8;
25421  case 'f': return (is_complex ? 8 : 4);
25422  case 'd': return (is_complex ? 16 : 8);
25423  case 'g': {
25424  PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
25425  return 0;
25426  }
25427  case 'O': case 'P': return sizeof(void*);
25428  default:
25429  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25430  return 0;
25431  }
25432 }
25433 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
25434  switch (ch) {
25435  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
25436  case 'h': case 'H': return sizeof(short);
25437  case 'i': case 'I': return sizeof(int);
25438  case 'l': case 'L': return sizeof(long);
25439  #ifdef HAVE_LONG_LONG
25440  case 'q': case 'Q': return sizeof(PY_LONG_LONG);
25441  #endif
25442  case 'f': return sizeof(float) * (is_complex ? 2 : 1);
25443  case 'd': return sizeof(double) * (is_complex ? 2 : 1);
25444  case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
25445  case 'O': case 'P': return sizeof(void*);
25446  default: {
25447  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25448  return 0;
25449  }
25450  }
25451 }
25452 typedef struct { char c; short x; } __Pyx_st_short;
25453 typedef struct { char c; int x; } __Pyx_st_int;
25454 typedef struct { char c; long x; } __Pyx_st_long;
25455 typedef struct { char c; float x; } __Pyx_st_float;
25456 typedef struct { char c; double x; } __Pyx_st_double;
25457 typedef struct { char c; long double x; } __Pyx_st_longdouble;
25458 typedef struct { char c; void *x; } __Pyx_st_void_p;
25459 #ifdef HAVE_LONG_LONG
25460 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
25461 #endif
25462 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
25463  switch (ch) {
25464  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
25465  case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
25466  case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
25467  case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
25468 #ifdef HAVE_LONG_LONG
25469  case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
25470 #endif
25471  case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
25472  case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
25473  case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
25474  case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
25475  default:
25476  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25477  return 0;
25478  }
25479 }
25480 /* These are for computing the padding at the end of the struct to align
25481  on the first member of the struct. This will probably the same as above,
25482  but we don't have any guarantees.
25483  */
25484 typedef struct { short x; char c; } __Pyx_pad_short;
25485 typedef struct { int x; char c; } __Pyx_pad_int;
25486 typedef struct { long x; char c; } __Pyx_pad_long;
25487 typedef struct { float x; char c; } __Pyx_pad_float;
25488 typedef struct { double x; char c; } __Pyx_pad_double;
25489 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
25490 typedef struct { void *x; char c; } __Pyx_pad_void_p;
25491 #ifdef HAVE_LONG_LONG
25492 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
25493 #endif
25494 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
25495  switch (ch) {
25496  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
25497  case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
25498  case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
25499  case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
25500 #ifdef HAVE_LONG_LONG
25501  case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
25502 #endif
25503  case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
25504  case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
25505  case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
25506  case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
25507  default:
25508  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25509  return 0;
25510  }
25511 }
25512 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
25513  switch (ch) {
25514  case 'c':
25515  return 'H';
25516  case 'b': case 'h': case 'i':
25517  case 'l': case 'q': case 's': case 'p':
25518  return 'I';
25519  case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
25520  return 'U';
25521  case 'f': case 'd': case 'g':
25522  return (is_complex ? 'C' : 'R');
25523  case 'O':
25524  return 'O';
25525  case 'P':
25526  return 'P';
25527  default: {
25528  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25529  return 0;
25530  }
25531  }
25532 }
25533 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
25534  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
25535  const char* expected;
25536  const char* quote;
25537  if (ctx->head == NULL) {
25538  expected = "end";
25539  quote = "";
25540  } else {
25541  expected = ctx->head->field->type->name;
25542  quote = "'";
25543  }
25544  PyErr_Format(PyExc_ValueError,
25545  "Buffer dtype mismatch, expected %s%s%s but got %s",
25546  quote, expected, quote,
25547  __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
25548  } else {
25549  __Pyx_StructField* field = ctx->head->field;
25550  __Pyx_StructField* parent = (ctx->head - 1)->field;
25551  PyErr_Format(PyExc_ValueError,
25552  "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
25553  field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
25554  parent->type->name, field->name);
25555  }
25556 }
25557 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
25558  char group;
25559  size_t size, offset, arraysize = 1;
25560  if (ctx->enc_type == 0) return 0;
25561  if (ctx->head->field->type->arraysize[0]) {
25562  int i, ndim = 0;
25563  if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
25564  ctx->is_valid_array = ctx->head->field->type->ndim == 1;
25565  ndim = 1;
25566  if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
25567  PyErr_Format(PyExc_ValueError,
25568  "Expected a dimension of size %zu, got %zu",
25569  ctx->head->field->type->arraysize[0], ctx->enc_count);
25570  return -1;
25571  }
25572  }
25573  if (!ctx->is_valid_array) {
25574  PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
25575  ctx->head->field->type->ndim, ndim);
25576  return -1;
25577  }
25578  for (i = 0; i < ctx->head->field->type->ndim; i++) {
25579  arraysize *= ctx->head->field->type->arraysize[i];
25580  }
25581  ctx->is_valid_array = 0;
25582  ctx->enc_count = 1;
25583  }
25584  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
25585  do {
25586  __Pyx_StructField* field = ctx->head->field;
25587  __Pyx_TypeInfo* type = field->type;
25588  if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
25589  size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
25590  } else {
25591  size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
25592  }
25593  if (ctx->enc_packmode == '@') {
25594  size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
25595  size_t align_mod_offset;
25596  if (align_at == 0) return -1;
25597  align_mod_offset = ctx->fmt_offset % align_at;
25598  if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
25599  if (ctx->struct_alignment == 0)
25600  ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
25601  ctx->is_complex);
25602  }
25603  if (type->size != size || type->typegroup != group) {
25604  if (type->typegroup == 'C' && type->fields != NULL) {
25605  size_t parent_offset = ctx->head->parent_offset + field->offset;
25606  ++ctx->head;
25607  ctx->head->field = type->fields;
25608  ctx->head->parent_offset = parent_offset;
25609  continue;
25610  }
25611  if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
25612  } else {
25613  __Pyx_BufFmt_RaiseExpected(ctx);
25614  return -1;
25615  }
25616  }
25617  offset = ctx->head->parent_offset + field->offset;
25618  if (ctx->fmt_offset != offset) {
25619  PyErr_Format(PyExc_ValueError,
25620  "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
25621  (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
25622  return -1;
25623  }
25624  ctx->fmt_offset += size;
25625  if (arraysize)
25626  ctx->fmt_offset += (arraysize - 1) * size;
25627  --ctx->enc_count;
25628  while (1) {
25629  if (field == &ctx->root) {
25630  ctx->head = NULL;
25631  if (ctx->enc_count != 0) {
25632  __Pyx_BufFmt_RaiseExpected(ctx);
25633  return -1;
25634  }
25635  break;
25636  }
25637  ctx->head->field = ++field;
25638  if (field->type == NULL) {
25639  --ctx->head;
25640  field = ctx->head->field;
25641  continue;
25642  } else if (field->type->typegroup == 'S') {
25643  size_t parent_offset = ctx->head->parent_offset + field->offset;
25644  if (field->type->fields->type == NULL) continue;
25645  field = field->type->fields;
25646  ++ctx->head;
25647  ctx->head->field = field;
25648  ctx->head->parent_offset = parent_offset;
25649  break;
25650  } else {
25651  break;
25652  }
25653  }
25654  } while (ctx->enc_count);
25655  ctx->enc_type = 0;
25656  ctx->is_complex = 0;
25657  return 0;
25658 }
25659 static PyObject *
25660 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
25661 {
25662  const char *ts = *tsp;
25663  int i = 0, number;
25664  int ndim = ctx->head->field->type->ndim;
25665 ;
25666  ++ts;
25667  if (ctx->new_count != 1) {
25668  PyErr_SetString(PyExc_ValueError,
25669  "Cannot handle repeated arrays in format string");
25670  return NULL;
25671  }
25672  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25673  while (*ts && *ts != ')') {
25674  switch (*ts) {
25675  case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
25676  default: break;
25677  }
25678  number = __Pyx_BufFmt_ExpectNumber(&ts);
25679  if (number == -1) return NULL;
25680  if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
25681  return PyErr_Format(PyExc_ValueError,
25682  "Expected a dimension of size %zu, got %d",
25683  ctx->head->field->type->arraysize[i], number);
25684  if (*ts != ',' && *ts != ')')
25685  return PyErr_Format(PyExc_ValueError,
25686  "Expected a comma in format string, got '%c'", *ts);
25687  if (*ts == ',') ts++;
25688  i++;
25689  }
25690  if (i != ndim)
25691  return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
25692  ctx->head->field->type->ndim, i);
25693  if (!*ts) {
25694  PyErr_SetString(PyExc_ValueError,
25695  "Unexpected end of format string, expected ')'");
25696  return NULL;
25697  }
25698  ctx->is_valid_array = 1;
25699  ctx->new_count = 1;
25700  *tsp = ++ts;
25701  return Py_None;
25702 }
25703 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
25704  int got_Z = 0;
25705  while (1) {
25706  switch(*ts) {
25707  case 0:
25708  if (ctx->enc_type != 0 && ctx->head == NULL) {
25709  __Pyx_BufFmt_RaiseExpected(ctx);
25710  return NULL;
25711  }
25712  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25713  if (ctx->head != NULL) {
25714  __Pyx_BufFmt_RaiseExpected(ctx);
25715  return NULL;
25716  }
25717  return ts;
25718  case ' ':
25719  case '\r':
25720  case '\n':
25721  ++ts;
25722  break;
25723  case '<':
25724  if (!__Pyx_Is_Little_Endian()) {
25725  PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
25726  return NULL;
25727  }
25728  ctx->new_packmode = '=';
25729  ++ts;
25730  break;
25731  case '>':
25732  case '!':
25733  if (__Pyx_Is_Little_Endian()) {
25734  PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
25735  return NULL;
25736  }
25737  ctx->new_packmode = '=';
25738  ++ts;
25739  break;
25740  case '=':
25741  case '@':
25742  case '^':
25743  ctx->new_packmode = *ts++;
25744  break;
25745  case 'T':
25746  {
25747  const char* ts_after_sub;
25748  size_t i, struct_count = ctx->new_count;
25749  size_t struct_alignment = ctx->struct_alignment;
25750  ctx->new_count = 1;
25751  ++ts;
25752  if (*ts != '{') {
25753  PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
25754  return NULL;
25755  }
25756  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25757  ctx->enc_type = 0;
25758  ctx->enc_count = 0;
25759  ctx->struct_alignment = 0;
25760  ++ts;
25761  ts_after_sub = ts;
25762  for (i = 0; i != struct_count; ++i) {
25763  ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
25764  if (!ts_after_sub) return NULL;
25765  }
25766  ts = ts_after_sub;
25767  if (struct_alignment) ctx->struct_alignment = struct_alignment;
25768  }
25769  break;
25770  case '}':
25771  {
25772  size_t alignment = ctx->struct_alignment;
25773  ++ts;
25774  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25775  ctx->enc_type = 0;
25776  if (alignment && ctx->fmt_offset % alignment) {
25777  ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
25778  }
25779  }
25780  return ts;
25781  case 'x':
25782  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25783  ctx->fmt_offset += ctx->new_count;
25784  ctx->new_count = 1;
25785  ctx->enc_count = 0;
25786  ctx->enc_type = 0;
25787  ctx->enc_packmode = ctx->new_packmode;
25788  ++ts;
25789  break;
25790  case 'Z':
25791  got_Z = 1;
25792  ++ts;
25793  if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
25794  __Pyx_BufFmt_RaiseUnexpectedChar('Z');
25795  return NULL;
25796  }
25797  CYTHON_FALLTHROUGH;
25798  case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
25799  case 'l': case 'L': case 'q': case 'Q':
25800  case 'f': case 'd': case 'g':
25801  case 'O': case 'p':
25802  if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
25803  ctx->enc_packmode == ctx->new_packmode) {
25804  ctx->enc_count += ctx->new_count;
25805  ctx->new_count = 1;
25806  got_Z = 0;
25807  ++ts;
25808  break;
25809  }
25810  CYTHON_FALLTHROUGH;
25811  case 's':
25812  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25813  ctx->enc_count = ctx->new_count;
25814  ctx->enc_packmode = ctx->new_packmode;
25815  ctx->enc_type = *ts;
25816  ctx->is_complex = got_Z;
25817  ++ts;
25818  ctx->new_count = 1;
25819  got_Z = 0;
25820  break;
25821  case ':':
25822  ++ts;
25823  while(*ts != ':') ++ts;
25824  ++ts;
25825  break;
25826  case '(':
25827  if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
25828  break;
25829  default:
25830  {
25831  int number = __Pyx_BufFmt_ExpectNumber(&ts);
25832  if (number == -1) return NULL;
25833  ctx->new_count = (size_t)number;
25834  }
25835  }
25836  }
25837 }
25838 
25839 /* BufferGetAndValidate */
25840  static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
25841  if (unlikely(info->buf == NULL)) return;
25842  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
25843  __Pyx_ReleaseBuffer(info);
25844 }
25845 static void __Pyx_ZeroBuffer(Py_buffer* buf) {
25846  buf->buf = NULL;
25847  buf->obj = NULL;
25848  buf->strides = __Pyx_zeros;
25849  buf->shape = __Pyx_zeros;
25850  buf->suboffsets = __Pyx_minusones;
25851 }
25852 static int __Pyx__GetBufferAndValidate(
25853  Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags,
25854  int nd, int cast, __Pyx_BufFmt_StackElem* stack)
25855 {
25856  buf->buf = NULL;
25857  if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) {
25858  __Pyx_ZeroBuffer(buf);
25859  return -1;
25860  }
25861  if (unlikely(buf->ndim != nd)) {
25862  PyErr_Format(PyExc_ValueError,
25863  "Buffer has wrong number of dimensions (expected %d, got %d)",
25864  nd, buf->ndim);
25865  goto fail;
25866  }
25867  if (!cast) {
25868  __Pyx_BufFmt_Context ctx;
25869  __Pyx_BufFmt_Init(&ctx, stack, dtype);
25870  if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
25871  }
25872  if (unlikely((size_t)buf->itemsize != dtype->size)) {
25873  PyErr_Format(PyExc_ValueError,
25874  "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
25875  buf->itemsize, (buf->itemsize > 1) ? "s" : "",
25876  dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
25877  goto fail;
25878  }
25879  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
25880  return 0;
25881 fail:;
25882  __Pyx_SafeReleaseBuffer(buf);
25883  return -1;
25884 }
25885 
25886 /* BufferIndexError */
25887  static void __Pyx_RaiseBufferIndexError(int axis) {
25888  PyErr_Format(PyExc_IndexError,
25889  "Out of bounds on buffer access (axis %d)", axis);
25890 }
25891 
25892 /* PyErrFetchRestore */
25893  #if CYTHON_FAST_THREAD_STATE
25894 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
25895  PyObject *tmp_type, *tmp_value, *tmp_tb;
25896  tmp_type = tstate->curexc_type;
25897  tmp_value = tstate->curexc_value;
25898  tmp_tb = tstate->curexc_traceback;
25899  tstate->curexc_type = type;
25900  tstate->curexc_value = value;
25901  tstate->curexc_traceback = tb;
25902  Py_XDECREF(tmp_type);
25903  Py_XDECREF(tmp_value);
25904  Py_XDECREF(tmp_tb);
25905 }
25906 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
25907  *type = tstate->curexc_type;
25908  *value = tstate->curexc_value;
25909  *tb = tstate->curexc_traceback;
25910  tstate->curexc_type = 0;
25911  tstate->curexc_value = 0;
25912  tstate->curexc_traceback = 0;
25913 }
25914 #endif
25915 
25916 /* DictGetItem */
25917  #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
25918 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
25919  PyObject *value;
25920  value = PyDict_GetItemWithError(d, key);
25921  if (unlikely(!value)) {
25922  if (!PyErr_Occurred()) {
25923  if (unlikely(PyTuple_Check(key))) {
25924  PyObject* args = PyTuple_Pack(1, key);
25925  if (likely(args)) {
25926  PyErr_SetObject(PyExc_KeyError, args);
25927  Py_DECREF(args);
25928  }
25929  } else {
25930  PyErr_SetObject(PyExc_KeyError, key);
25931  }
25932  }
25933  return NULL;
25934  }
25935  Py_INCREF(value);
25936  return value;
25937 }
25938 #endif
25939 
25940 /* GetItemInt */
25941  static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
25942  PyObject *r;
25943  if (!j) return NULL;
25944  r = PyObject_GetItem(o, j);
25945  Py_DECREF(j);
25946  return r;
25947 }
25948 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
25949  CYTHON_NCP_UNUSED int wraparound,
25950  CYTHON_NCP_UNUSED int boundscheck) {
25951 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
25952  Py_ssize_t wrapped_i = i;
25953  if (wraparound & unlikely(i < 0)) {
25954  wrapped_i += PyList_GET_SIZE(o);
25955  }
25956  if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
25957  PyObject *r = PyList_GET_ITEM(o, wrapped_i);
25958  Py_INCREF(r);
25959  return r;
25960  }
25961  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
25962 #else
25963  return PySequence_GetItem(o, i);
25964 #endif
25965 }
25966 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
25967  CYTHON_NCP_UNUSED int wraparound,
25968  CYTHON_NCP_UNUSED int boundscheck) {
25969 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
25970  Py_ssize_t wrapped_i = i;
25971  if (wraparound & unlikely(i < 0)) {
25972  wrapped_i += PyTuple_GET_SIZE(o);
25973  }
25974  if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
25975  PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
25976  Py_INCREF(r);
25977  return r;
25978  }
25979  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
25980 #else
25981  return PySequence_GetItem(o, i);
25982 #endif
25983 }
25984 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
25985  CYTHON_NCP_UNUSED int wraparound,
25986  CYTHON_NCP_UNUSED int boundscheck) {
25987 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
25988  if (is_list || PyList_CheckExact(o)) {
25989  Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
25990  if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
25991  PyObject *r = PyList_GET_ITEM(o, n);
25992  Py_INCREF(r);
25993  return r;
25994  }
25995  }
25996  else if (PyTuple_CheckExact(o)) {
25997  Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
25998  if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
25999  PyObject *r = PyTuple_GET_ITEM(o, n);
26000  Py_INCREF(r);
26001  return r;
26002  }
26003  } else {
26004  PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
26005  if (likely(m && m->sq_item)) {
26006  if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
26007  Py_ssize_t l = m->sq_length(o);
26008  if (likely(l >= 0)) {
26009  i += l;
26010  } else {
26011  if (!PyErr_ExceptionMatches(PyExc_OverflowError))
26012  return NULL;
26013  PyErr_Clear();
26014  }
26015  }
26016  return m->sq_item(o, i);
26017  }
26018  }
26019 #else
26020  if (is_list || PySequence_Check(o)) {
26021  return PySequence_GetItem(o, i);
26022  }
26023 #endif
26024  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
26025 }
26026 
26027 /* ObjectGetItem */
26028  #if CYTHON_USE_TYPE_SLOTS
26029 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
26030  PyObject *runerr;
26031  Py_ssize_t key_value;
26032  PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
26033  if (unlikely(!(m && m->sq_item))) {
26034  PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
26035  return NULL;
26036  }
26037  key_value = __Pyx_PyIndex_AsSsize_t(index);
26038  if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
26039  return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
26040  }
26041  if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
26042  PyErr_Clear();
26043  PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
26044  }
26045  return NULL;
26046 }
26047 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
26048  PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
26049  if (likely(m && m->mp_subscript)) {
26050  return m->mp_subscript(obj, key);
26051  }
26052  return __Pyx_PyObject_GetIndex(obj, key);
26053 }
26054 #endif
26055 
26056 /* PyFloatBinop */
26057  #if !CYTHON_COMPILING_IN_PYPY
26058 static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
26059  const double b = floatval;
26060  double a, result;
26061  (void)inplace;
26062  (void)zerodivision_check;
26063  if (likely(PyFloat_CheckExact(op1))) {
26064  a = PyFloat_AS_DOUBLE(op1);
26065 
26066  } else
26067  #if PY_MAJOR_VERSION < 3
26068  if (likely(PyInt_CheckExact(op1))) {
26069  a = (double) PyInt_AS_LONG(op1);
26070 
26071  } else
26072  #endif
26073  if (likely(PyLong_CheckExact(op1))) {
26074  #if CYTHON_USE_PYLONG_INTERNALS
26075  const digit* digits = ((PyLongObject*)op1)->ob_digit;
26076  const Py_ssize_t size = Py_SIZE(op1);
26077  switch (size) {
26078  case 0: a = 0.0; break;
26079  case -1: a = -(double) digits[0]; break;
26080  case 1: a = (double) digits[0]; break;
26081  case -2:
26082  case 2:
26083  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
26084  a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
26085  if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
26086  if (size == -2)
26087  a = -a;
26088  break;
26089  }
26090  }
26091  CYTHON_FALLTHROUGH;
26092  case -3:
26093  case 3:
26094  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
26095  a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
26096  if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
26097  if (size == -3)
26098  a = -a;
26099  break;
26100  }
26101  }
26102  CYTHON_FALLTHROUGH;
26103  case -4:
26104  case 4:
26105  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
26106  a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
26107  if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
26108  if (size == -4)
26109  a = -a;
26110  break;
26111  }
26112  }
26113  CYTHON_FALLTHROUGH;
26114  default:
26115  #else
26116  {
26117  #endif
26118  a = PyLong_AsDouble(op1);
26119  if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
26120 
26121  }
26122  } else {
26123  return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
26124  }
26125 
26126  PyFPE_START_PROTECT("add", return NULL)
26127  result = a + b;
26128  PyFPE_END_PROTECT(result)
26129  return PyFloat_FromDouble(result);
26130 }
26131 #endif
26132 
26133 /* PyFunctionFastCall */
26134  #if CYTHON_FAST_PYCALL
26135 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
26136  PyObject *globals) {
26137  PyFrameObject *f;
26138  PyThreadState *tstate = __Pyx_PyThreadState_Current;
26139  PyObject **fastlocals;
26140  Py_ssize_t i;
26141  PyObject *result;
26142  assert(globals != NULL);
26143  /* XXX Perhaps we should create a specialized
26144  PyFrame_New() that doesn't take locals, but does
26145  take builtins without sanity checking them.
26146  */
26147  assert(tstate != NULL);
26148  f = PyFrame_New(tstate, co, globals, NULL);
26149  if (f == NULL) {
26150  return NULL;
26151  }
26152  fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
26153  for (i = 0; i < na; i++) {
26154  Py_INCREF(*args);
26155  fastlocals[i] = *args++;
26156  }
26157  result = PyEval_EvalFrameEx(f,0);
26158  ++tstate->recursion_depth;
26159  Py_DECREF(f);
26160  --tstate->recursion_depth;
26161  return result;
26162 }
26163 #if 1 || PY_VERSION_HEX < 0x030600B1
26164 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
26165  PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
26166  PyObject *globals = PyFunction_GET_GLOBALS(func);
26167  PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
26168  PyObject *closure;
26169 #if PY_MAJOR_VERSION >= 3
26170  PyObject *kwdefs;
26171 #endif
26172  PyObject *kwtuple, **k;
26173  PyObject **d;
26174  Py_ssize_t nd;
26175  Py_ssize_t nk;
26176  PyObject *result;
26177  assert(kwargs == NULL || PyDict_Check(kwargs));
26178  nk = kwargs ? PyDict_Size(kwargs) : 0;
26179  if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
26180  return NULL;
26181  }
26182  if (
26183 #if PY_MAJOR_VERSION >= 3
26184  co->co_kwonlyargcount == 0 &&
26185 #endif
26186  likely(kwargs == NULL || nk == 0) &&
26187  co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
26188  if (argdefs == NULL && co->co_argcount == nargs) {
26189  result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
26190  goto done;
26191  }
26192  else if (nargs == 0 && argdefs != NULL
26193  && co->co_argcount == Py_SIZE(argdefs)) {
26194  /* function called with no arguments, but all parameters have
26195  a default value: use default values as arguments .*/
26196  args = &PyTuple_GET_ITEM(argdefs, 0);
26197  result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
26198  goto done;
26199  }
26200  }
26201  if (kwargs != NULL) {
26202  Py_ssize_t pos, i;
26203  kwtuple = PyTuple_New(2 * nk);
26204  if (kwtuple == NULL) {
26205  result = NULL;
26206  goto done;
26207  }
26208  k = &PyTuple_GET_ITEM(kwtuple, 0);
26209  pos = i = 0;
26210  while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
26211  Py_INCREF(k[i]);
26212  Py_INCREF(k[i+1]);
26213  i += 2;
26214  }
26215  nk = i / 2;
26216  }
26217  else {
26218  kwtuple = NULL;
26219  k = NULL;
26220  }
26221  closure = PyFunction_GET_CLOSURE(func);
26222 #if PY_MAJOR_VERSION >= 3
26223  kwdefs = PyFunction_GET_KW_DEFAULTS(func);
26224 #endif
26225  if (argdefs != NULL) {
26226  d = &PyTuple_GET_ITEM(argdefs, 0);
26227  nd = Py_SIZE(argdefs);
26228  }
26229  else {
26230  d = NULL;
26231  nd = 0;
26232  }
26233 #if PY_MAJOR_VERSION >= 3
26234  result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
26235  args, (int)nargs,
26236  k, (int)nk,
26237  d, (int)nd, kwdefs, closure);
26238 #else
26239  result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
26240  args, (int)nargs,
26241  k, (int)nk,
26242  d, (int)nd, closure);
26243 #endif
26244  Py_XDECREF(kwtuple);
26245 done:
26246  Py_LeaveRecursiveCall();
26247  return result;
26248 }
26249 #endif
26250 #endif
26251 
26252 /* PyCFunctionFastCall */
26253  #if CYTHON_FAST_PYCCALL
26254 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
26255  PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
26256  PyCFunction meth = PyCFunction_GET_FUNCTION(func);
26257  PyObject *self = PyCFunction_GET_SELF(func);
26258  int flags = PyCFunction_GET_FLAGS(func);
26259  assert(PyCFunction_Check(func));
26260  assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
26261  assert(nargs >= 0);
26262  assert(nargs == 0 || args != NULL);
26263  /* _PyCFunction_FastCallDict() must not be called with an exception set,
26264  because it may clear it (directly or indirectly) and so the
26265  caller loses its exception */
26266  assert(!PyErr_Occurred());
26267  if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
26268  return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
26269  } else {
26270  return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
26271  }
26272 }
26273 #endif
26274 
26275 /* PyObjectCall */
26276  #if CYTHON_COMPILING_IN_CPYTHON
26277 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
26278  PyObject *result;
26279  ternaryfunc call = func->ob_type->tp_call;
26280  if (unlikely(!call))
26281  return PyObject_Call(func, arg, kw);
26282  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
26283  return NULL;
26284  result = (*call)(func, arg, kw);
26285  Py_LeaveRecursiveCall();
26286  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
26287  PyErr_SetString(
26288  PyExc_SystemError,
26289  "NULL result without error in PyObject_Call");
26290  }
26291  return result;
26292 }
26293 #endif
26294 
26295 /* PyDictVersioning */
26296  #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
26297 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
26298  PyObject *dict = Py_TYPE(obj)->tp_dict;
26299  return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
26300 }
26301 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
26302  PyObject **dictptr = NULL;
26303  Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
26304  if (offset) {
26305 #if CYTHON_COMPILING_IN_CPYTHON
26306  dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
26307 #else
26308  dictptr = _PyObject_GetDictPtr(obj);
26309 #endif
26310  }
26311  return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
26312 }
26313 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
26314  PyObject *dict = Py_TYPE(obj)->tp_dict;
26315  if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
26316  return 0;
26317  return obj_dict_version == __Pyx_get_object_dict_version(obj);
26318 }
26319 #endif
26320 
26321 /* GetModuleGlobalName */
26322  #if CYTHON_USE_DICT_VERSIONS
26323 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
26324 #else
26325 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
26326 #endif
26327 {
26328  PyObject *result;
26329 #if !CYTHON_AVOID_BORROWED_REFS
26330 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
26331  result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
26332  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
26333  if (likely(result)) {
26334  return __Pyx_NewRef(result);
26335  } else if (unlikely(PyErr_Occurred())) {
26336  return NULL;
26337  }
26338 #else
26339  result = PyDict_GetItem(__pyx_d, name);
26340  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
26341  if (likely(result)) {
26342  return __Pyx_NewRef(result);
26343  }
26344 #endif
26345 #else
26346  result = PyObject_GetItem(__pyx_d, name);
26347  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
26348  if (likely(result)) {
26349  return __Pyx_NewRef(result);
26350  }
26351  PyErr_Clear();
26352 #endif
26353  return __Pyx_GetBuiltinName(name);
26354 }
26355 
26356 /* ExtTypeTest */
26357  static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
26358  if (unlikely(!type)) {
26359  PyErr_SetString(PyExc_SystemError, "Missing type object");
26360  return 0;
26361  }
26362  if (likely(__Pyx_TypeCheck(obj, type)))
26363  return 1;
26364  PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
26365  Py_TYPE(obj)->tp_name, type->tp_name);
26366  return 0;
26367 }
26368 
26369 /* PyObjectCall2Args */
26370  static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
26371  PyObject *args, *result = NULL;
26372  #if CYTHON_FAST_PYCALL
26373  if (PyFunction_Check(function)) {
26374  PyObject *args[2] = {arg1, arg2};
26375  return __Pyx_PyFunction_FastCall(function, args, 2);
26376  }
26377  #endif
26378  #if CYTHON_FAST_PYCCALL
26379  if (__Pyx_PyFastCFunction_Check(function)) {
26380  PyObject *args[2] = {arg1, arg2};
26381  return __Pyx_PyCFunction_FastCall(function, args, 2);
26382  }
26383  #endif
26384  args = PyTuple_New(2);
26385  if (unlikely(!args)) goto done;
26386  Py_INCREF(arg1);
26387  PyTuple_SET_ITEM(args, 0, arg1);
26388  Py_INCREF(arg2);
26389  PyTuple_SET_ITEM(args, 1, arg2);
26390  Py_INCREF(function);
26391  result = __Pyx_PyObject_Call(function, args, NULL);
26392  Py_DECREF(args);
26393  Py_DECREF(function);
26394 done:
26395  return result;
26396 }
26397 
26398 /* PyObjectCallMethO */
26399  #if CYTHON_COMPILING_IN_CPYTHON
26400 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
26401  PyObject *self, *result;
26402  PyCFunction cfunc;
26403  cfunc = PyCFunction_GET_FUNCTION(func);
26404  self = PyCFunction_GET_SELF(func);
26405  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
26406  return NULL;
26407  result = cfunc(self, arg);
26408  Py_LeaveRecursiveCall();
26409  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
26410  PyErr_SetString(
26411  PyExc_SystemError,
26412  "NULL result without error in PyObject_Call");
26413  }
26414  return result;
26415 }
26416 #endif
26417 
26418 /* PyObjectCallOneArg */
26419  #if CYTHON_COMPILING_IN_CPYTHON
26420 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
26421  PyObject *result;
26422  PyObject *args = PyTuple_New(1);
26423  if (unlikely(!args)) return NULL;
26424  Py_INCREF(arg);
26425  PyTuple_SET_ITEM(args, 0, arg);
26426  result = __Pyx_PyObject_Call(func, args, NULL);
26427  Py_DECREF(args);
26428  return result;
26429 }
26430 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
26431 #if CYTHON_FAST_PYCALL
26432  if (PyFunction_Check(func)) {
26433  return __Pyx_PyFunction_FastCall(func, &arg, 1);
26434  }
26435 #endif
26436  if (likely(PyCFunction_Check(func))) {
26437  if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
26438  return __Pyx_PyObject_CallMethO(func, arg);
26439 #if CYTHON_FAST_PYCCALL
26440  } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
26441  return __Pyx_PyCFunction_FastCall(func, &arg, 1);
26442 #endif
26443  }
26444  }
26445  return __Pyx__PyObject_CallOneArg(func, arg);
26446 }
26447 #else
26448 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
26449  PyObject *result;
26450  PyObject *args = PyTuple_Pack(1, arg);
26451  if (unlikely(!args)) return NULL;
26452  result = __Pyx_PyObject_Call(func, args, NULL);
26453  Py_DECREF(args);
26454  return result;
26455 }
26456 #endif
26457 
26458 /* pyobject_as_double */
26459  static double __Pyx__PyObject_AsDouble(PyObject* obj) {
26460  PyObject* float_value;
26461 #if !CYTHON_USE_TYPE_SLOTS
26462  float_value = PyNumber_Float(obj); if ((0)) goto bad;
26463 #else
26464  PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
26465  if (likely(nb) && likely(nb->nb_float)) {
26466  float_value = nb->nb_float(obj);
26467  if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) {
26468  PyErr_Format(PyExc_TypeError,
26469  "__float__ returned non-float (type %.200s)",
26470  Py_TYPE(float_value)->tp_name);
26471  Py_DECREF(float_value);
26472  goto bad;
26473  }
26474  } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
26475 #if PY_MAJOR_VERSION >= 3
26476  float_value = PyFloat_FromString(obj);
26477 #else
26478  float_value = PyFloat_FromString(obj, 0);
26479 #endif
26480  } else {
26481  PyObject* args = PyTuple_New(1);
26482  if (unlikely(!args)) goto bad;
26483  PyTuple_SET_ITEM(args, 0, obj);
26484  float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
26485  PyTuple_SET_ITEM(args, 0, 0);
26486  Py_DECREF(args);
26487  }
26488 #endif
26489  if (likely(float_value)) {
26490  double value = PyFloat_AS_DOUBLE(float_value);
26491  Py_DECREF(float_value);
26492  return value;
26493  }
26494 bad:
26495  return (double)-1;
26496 }
26497 
26498 /* RaiseException */
26499  #if PY_MAJOR_VERSION < 3
26500 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
26501  CYTHON_UNUSED PyObject *cause) {
26502  __Pyx_PyThreadState_declare
26503  Py_XINCREF(type);
26504  if (!value || value == Py_None)
26505  value = NULL;
26506  else
26507  Py_INCREF(value);
26508  if (!tb || tb == Py_None)
26509  tb = NULL;
26510  else {
26511  Py_INCREF(tb);
26512  if (!PyTraceBack_Check(tb)) {
26513  PyErr_SetString(PyExc_TypeError,
26514  "raise: arg 3 must be a traceback or None");
26515  goto raise_error;
26516  }
26517  }
26518  if (PyType_Check(type)) {
26519 #if CYTHON_COMPILING_IN_PYPY
26520  if (!value) {
26521  Py_INCREF(Py_None);
26522  value = Py_None;
26523  }
26524 #endif
26525  PyErr_NormalizeException(&type, &value, &tb);
26526  } else {
26527  if (value) {
26528  PyErr_SetString(PyExc_TypeError,
26529  "instance exception may not have a separate value");
26530  goto raise_error;
26531  }
26532  value = type;
26533  type = (PyObject*) Py_TYPE(type);
26534  Py_INCREF(type);
26535  if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
26536  PyErr_SetString(PyExc_TypeError,
26537  "raise: exception class must be a subclass of BaseException");
26538  goto raise_error;
26539  }
26540  }
26541  __Pyx_PyThreadState_assign
26542  __Pyx_ErrRestore(type, value, tb);
26543  return;
26544 raise_error:
26545  Py_XDECREF(value);
26546  Py_XDECREF(type);
26547  Py_XDECREF(tb);
26548  return;
26549 }
26550 #else
26551 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
26552  PyObject* owned_instance = NULL;
26553  if (tb == Py_None) {
26554  tb = 0;
26555  } else if (tb && !PyTraceBack_Check(tb)) {
26556  PyErr_SetString(PyExc_TypeError,
26557  "raise: arg 3 must be a traceback or None");
26558  goto bad;
26559  }
26560  if (value == Py_None)
26561  value = 0;
26562  if (PyExceptionInstance_Check(type)) {
26563  if (value) {
26564  PyErr_SetString(PyExc_TypeError,
26565  "instance exception may not have a separate value");
26566  goto bad;
26567  }
26568  value = type;
26569  type = (PyObject*) Py_TYPE(value);
26570  } else if (PyExceptionClass_Check(type)) {
26571  PyObject *instance_class = NULL;
26572  if (value && PyExceptionInstance_Check(value)) {
26573  instance_class = (PyObject*) Py_TYPE(value);
26574  if (instance_class != type) {
26575  int is_subclass = PyObject_IsSubclass(instance_class, type);
26576  if (!is_subclass) {
26577  instance_class = NULL;
26578  } else if (unlikely(is_subclass == -1)) {
26579  goto bad;
26580  } else {
26581  type = instance_class;
26582  }
26583  }
26584  }
26585  if (!instance_class) {
26586  PyObject *args;
26587  if (!value)
26588  args = PyTuple_New(0);
26589  else if (PyTuple_Check(value)) {
26590  Py_INCREF(value);
26591  args = value;
26592  } else
26593  args = PyTuple_Pack(1, value);
26594  if (!args)
26595  goto bad;
26596  owned_instance = PyObject_Call(type, args, NULL);
26597  Py_DECREF(args);
26598  if (!owned_instance)
26599  goto bad;
26600  value = owned_instance;
26601  if (!PyExceptionInstance_Check(value)) {
26602  PyErr_Format(PyExc_TypeError,
26603  "calling %R should have returned an instance of "
26604  "BaseException, not %R",
26605  type, Py_TYPE(value));
26606  goto bad;
26607  }
26608  }
26609  } else {
26610  PyErr_SetString(PyExc_TypeError,
26611  "raise: exception class must be a subclass of BaseException");
26612  goto bad;
26613  }
26614  if (cause) {
26615  PyObject *fixed_cause;
26616  if (cause == Py_None) {
26617  fixed_cause = NULL;
26618  } else if (PyExceptionClass_Check(cause)) {
26619  fixed_cause = PyObject_CallObject(cause, NULL);
26620  if (fixed_cause == NULL)
26621  goto bad;
26622  } else if (PyExceptionInstance_Check(cause)) {
26623  fixed_cause = cause;
26624  Py_INCREF(fixed_cause);
26625  } else {
26626  PyErr_SetString(PyExc_TypeError,
26627  "exception causes must derive from "
26628  "BaseException");
26629  goto bad;
26630  }
26631  PyException_SetCause(value, fixed_cause);
26632  }
26633  PyErr_SetObject(type, value);
26634  if (tb) {
26635 #if CYTHON_COMPILING_IN_PYPY
26636  PyObject *tmp_type, *tmp_value, *tmp_tb;
26637  PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
26638  Py_INCREF(tb);
26639  PyErr_Restore(tmp_type, tmp_value, tb);
26640  Py_XDECREF(tmp_tb);
26641 #else
26642  PyThreadState *tstate = __Pyx_PyThreadState_Current;
26643  PyObject* tmp_tb = tstate->curexc_traceback;
26644  if (tb != tmp_tb) {
26645  Py_INCREF(tb);
26646  tstate->curexc_traceback = tb;
26647  Py_XDECREF(tmp_tb);
26648  }
26649 #endif
26650  }
26651 bad:
26652  Py_XDECREF(owned_instance);
26653  return;
26654 }
26655 #endif
26656 
26657 /* RaiseTooManyValuesToUnpack */
26658  static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
26659  PyErr_Format(PyExc_ValueError,
26660  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
26661 }
26662 
26663 /* RaiseNeedMoreValuesToUnpack */
26664  static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
26665  PyErr_Format(PyExc_ValueError,
26666  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
26667  index, (index == 1) ? "" : "s");
26668 }
26669 
26670 /* RaiseNoneIterError */
26671  static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
26672  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
26673 }
26674 
26675 /* GetTopmostException */
26676  #if CYTHON_USE_EXC_INFO_STACK
26677 static _PyErr_StackItem *
26678 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
26679 {
26680  _PyErr_StackItem *exc_info = tstate->exc_info;
26681  while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
26682  exc_info->previous_item != NULL)
26683  {
26684  exc_info = exc_info->previous_item;
26685  }
26686  return exc_info;
26687 }
26688 #endif
26689 
26690 /* SaveResetException */
26691  #if CYTHON_FAST_THREAD_STATE
26692 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
26693  #if CYTHON_USE_EXC_INFO_STACK
26694  _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
26695  *type = exc_info->exc_type;
26696  *value = exc_info->exc_value;
26697  *tb = exc_info->exc_traceback;
26698  #else
26699  *type = tstate->exc_type;
26700  *value = tstate->exc_value;
26701  *tb = tstate->exc_traceback;
26702  #endif
26703  Py_XINCREF(*type);
26704  Py_XINCREF(*value);
26705  Py_XINCREF(*tb);
26706 }
26707 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
26708  PyObject *tmp_type, *tmp_value, *tmp_tb;
26709  #if CYTHON_USE_EXC_INFO_STACK
26710  _PyErr_StackItem *exc_info = tstate->exc_info;
26711  tmp_type = exc_info->exc_type;
26712  tmp_value = exc_info->exc_value;
26713  tmp_tb = exc_info->exc_traceback;
26714  exc_info->exc_type = type;
26715  exc_info->exc_value = value;
26716  exc_info->exc_traceback = tb;
26717  #else
26718  tmp_type = tstate->exc_type;
26719  tmp_value = tstate->exc_value;
26720  tmp_tb = tstate->exc_traceback;
26721  tstate->exc_type = type;
26722  tstate->exc_value = value;
26723  tstate->exc_traceback = tb;
26724  #endif
26725  Py_XDECREF(tmp_type);
26726  Py_XDECREF(tmp_value);
26727  Py_XDECREF(tmp_tb);
26728 }
26729 #endif
26730 
26731 /* PyErrExceptionMatches */
26732  #if CYTHON_FAST_THREAD_STATE
26733 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
26734  Py_ssize_t i, n;
26735  n = PyTuple_GET_SIZE(tuple);
26736 #if PY_MAJOR_VERSION >= 3
26737  for (i=0; i<n; i++) {
26738  if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
26739  }
26740 #endif
26741  for (i=0; i<n; i++) {
26742  if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
26743  }
26744  return 0;
26745 }
26746 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
26747  PyObject *exc_type = tstate->curexc_type;
26748  if (exc_type == err) return 1;
26749  if (unlikely(!exc_type)) return 0;
26750  if (unlikely(PyTuple_Check(err)))
26751  return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
26752  return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
26753 }
26754 #endif
26755 
26756 /* GetException */
26757  #if CYTHON_FAST_THREAD_STATE
26758 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
26759 #else
26760 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
26761 #endif
26762 {
26763  PyObject *local_type, *local_value, *local_tb;
26764 #if CYTHON_FAST_THREAD_STATE
26765  PyObject *tmp_type, *tmp_value, *tmp_tb;
26766  local_type = tstate->curexc_type;
26767  local_value = tstate->curexc_value;
26768  local_tb = tstate->curexc_traceback;
26769  tstate->curexc_type = 0;
26770  tstate->curexc_value = 0;
26771  tstate->curexc_traceback = 0;
26772 #else
26773  PyErr_Fetch(&local_type, &local_value, &local_tb);
26774 #endif
26775  PyErr_NormalizeException(&local_type, &local_value, &local_tb);
26776 #if CYTHON_FAST_THREAD_STATE
26777  if (unlikely(tstate->curexc_type))
26778 #else
26779  if (unlikely(PyErr_Occurred()))
26780 #endif
26781  goto bad;
26782  #if PY_MAJOR_VERSION >= 3
26783  if (local_tb) {
26784  if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
26785  goto bad;
26786  }
26787  #endif
26788  Py_XINCREF(local_tb);
26789  Py_XINCREF(local_type);
26790  Py_XINCREF(local_value);
26791  *type = local_type;
26792  *value = local_value;
26793  *tb = local_tb;
26794 #if CYTHON_FAST_THREAD_STATE
26795  #if CYTHON_USE_EXC_INFO_STACK
26796  {
26797  _PyErr_StackItem *exc_info = tstate->exc_info;
26798  tmp_type = exc_info->exc_type;
26799  tmp_value = exc_info->exc_value;
26800  tmp_tb = exc_info->exc_traceback;
26801  exc_info->exc_type = local_type;
26802  exc_info->exc_value = local_value;
26803  exc_info->exc_traceback = local_tb;
26804  }
26805  #else
26806  tmp_type = tstate->exc_type;
26807  tmp_value = tstate->exc_value;
26808  tmp_tb = tstate->exc_traceback;
26809  tstate->exc_type = local_type;
26810  tstate->exc_value = local_value;
26811  tstate->exc_traceback = local_tb;
26812  #endif
26813  Py_XDECREF(tmp_type);
26814  Py_XDECREF(tmp_value);
26815  Py_XDECREF(tmp_tb);
26816 #else
26817  PyErr_SetExcInfo(local_type, local_value, local_tb);
26818 #endif
26819  return 0;
26820 bad:
26821  *type = 0;
26822  *value = 0;
26823  *tb = 0;
26824  Py_XDECREF(local_type);
26825  Py_XDECREF(local_value);
26826  Py_XDECREF(local_tb);
26827  return -1;
26828 }
26829 
26830 /* TypeImport */
26831  #ifndef __PYX_HAVE_RT_ImportType
26832 #define __PYX_HAVE_RT_ImportType
26833 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
26834  size_t size, enum __Pyx_ImportType_CheckSize check_size)
26835 {
26836  PyObject *result = 0;
26837  char warning[200];
26838  Py_ssize_t basicsize;
26839 #ifdef Py_LIMITED_API
26840  PyObject *py_basicsize;
26841 #endif
26842  result = PyObject_GetAttrString(module, class_name);
26843  if (!result)
26844  goto bad;
26845  if (!PyType_Check(result)) {
26846  PyErr_Format(PyExc_TypeError,
26847  "%.200s.%.200s is not a type object",
26848  module_name, class_name);
26849  goto bad;
26850  }
26851 #ifndef Py_LIMITED_API
26852  basicsize = ((PyTypeObject *)result)->tp_basicsize;
26853 #else
26854  py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
26855  if (!py_basicsize)
26856  goto bad;
26857  basicsize = PyLong_AsSsize_t(py_basicsize);
26858  Py_DECREF(py_basicsize);
26859  py_basicsize = 0;
26860  if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
26861  goto bad;
26862 #endif
26863  if ((size_t)basicsize < size) {
26864  PyErr_Format(PyExc_ValueError,
26865  "%.200s.%.200s size changed, may indicate binary incompatibility. "
26866  "Expected %zd from C header, got %zd from PyObject",
26867  module_name, class_name, size, basicsize);
26868  goto bad;
26869  }
26870  if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
26871  PyErr_Format(PyExc_ValueError,
26872  "%.200s.%.200s size changed, may indicate binary incompatibility. "
26873  "Expected %zd from C header, got %zd from PyObject",
26874  module_name, class_name, size, basicsize);
26875  goto bad;
26876  }
26877  else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
26878  PyOS_snprintf(warning, sizeof(warning),
26879  "%s.%s size changed, may indicate binary incompatibility. "
26880  "Expected %zd from C header, got %zd from PyObject",
26881  module_name, class_name, size, basicsize);
26882  if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
26883  }
26884  return (PyTypeObject *)result;
26885 bad:
26886  Py_XDECREF(result);
26887  return NULL;
26888 }
26889 #endif
26890 
26891 /* Import */
26892  static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
26893  PyObject *empty_list = 0;
26894  PyObject *module = 0;
26895  PyObject *global_dict = 0;
26896  PyObject *empty_dict = 0;
26897  PyObject *list;
26898  #if PY_MAJOR_VERSION < 3
26899  PyObject *py_import;
26900  py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
26901  if (!py_import)
26902  goto bad;
26903  #endif
26904  if (from_list)
26905  list = from_list;
26906  else {
26907  empty_list = PyList_New(0);
26908  if (!empty_list)
26909  goto bad;
26910  list = empty_list;
26911  }
26912  global_dict = PyModule_GetDict(__pyx_m);
26913  if (!global_dict)
26914  goto bad;
26915  empty_dict = PyDict_New();
26916  if (!empty_dict)
26917  goto bad;
26918  {
26919  #if PY_MAJOR_VERSION >= 3
26920  if (level == -1) {
26921  if (strchr(__Pyx_MODULE_NAME, '.')) {
26922  module = PyImport_ImportModuleLevelObject(
26923  name, global_dict, empty_dict, list, 1);
26924  if (!module) {
26925  if (!PyErr_ExceptionMatches(PyExc_ImportError))
26926  goto bad;
26927  PyErr_Clear();
26928  }
26929  }
26930  level = 0;
26931  }
26932  #endif
26933  if (!module) {
26934  #if PY_MAJOR_VERSION < 3
26935  PyObject *py_level = PyInt_FromLong(level);
26936  if (!py_level)
26937  goto bad;
26938  module = PyObject_CallFunctionObjArgs(py_import,
26939  name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
26940  Py_DECREF(py_level);
26941  #else
26942  module = PyImport_ImportModuleLevelObject(
26943  name, global_dict, empty_dict, list, level);
26944  #endif
26945  }
26946  }
26947 bad:
26948  #if PY_MAJOR_VERSION < 3
26949  Py_XDECREF(py_import);
26950  #endif
26951  Py_XDECREF(empty_list);
26952  Py_XDECREF(empty_dict);
26953  return module;
26954 }
26955 
26956 /* CLineInTraceback */
26957  #ifndef CYTHON_CLINE_IN_TRACEBACK
26958 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
26959  PyObject *use_cline;
26960  PyObject *ptype, *pvalue, *ptraceback;
26961 #if CYTHON_COMPILING_IN_CPYTHON
26962  PyObject **cython_runtime_dict;
26963 #endif
26964  if (unlikely(!__pyx_cython_runtime)) {
26965  return c_line;
26966  }
26967  __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
26968 #if CYTHON_COMPILING_IN_CPYTHON
26969  cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
26970  if (likely(cython_runtime_dict)) {
26971  __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
26972  use_cline, *cython_runtime_dict,
26973  __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
26974  } else
26975 #endif
26976  {
26977  PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
26978  if (use_cline_obj) {
26979  use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
26980  Py_DECREF(use_cline_obj);
26981  } else {
26982  PyErr_Clear();
26983  use_cline = NULL;
26984  }
26985  }
26986  if (!use_cline) {
26987  c_line = 0;
26988  PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
26989  }
26990  else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
26991  c_line = 0;
26992  }
26993  __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
26994  return c_line;
26995 }
26996 #endif
26997 
26998 /* CodeObjectCache */
26999  static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
27000  int start = 0, mid = 0, end = count - 1;
27001  if (end >= 0 && code_line > entries[end].code_line) {
27002  return count;
27003  }
27004  while (start < end) {
27005  mid = start + (end - start) / 2;
27006  if (code_line < entries[mid].code_line) {
27007  end = mid;
27008  } else if (code_line > entries[mid].code_line) {
27009  start = mid + 1;
27010  } else {
27011  return mid;
27012  }
27013  }
27014  if (code_line <= entries[mid].code_line) {
27015  return mid;
27016  } else {
27017  return mid + 1;
27018  }
27019 }
27020 static PyCodeObject *__pyx_find_code_object(int code_line) {
27021  PyCodeObject* code_object;
27022  int pos;
27023  if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
27024  return NULL;
27025  }
27026  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
27027  if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
27028  return NULL;
27029  }
27030  code_object = __pyx_code_cache.entries[pos].code_object;
27031  Py_INCREF(code_object);
27032  return code_object;
27033 }
27034 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
27035  int pos, i;
27036  __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
27037  if (unlikely(!code_line)) {
27038  return;
27039  }
27040  if (unlikely(!entries)) {
27041  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
27042  if (likely(entries)) {
27043  __pyx_code_cache.entries = entries;
27044  __pyx_code_cache.max_count = 64;
27045  __pyx_code_cache.count = 1;
27046  entries[0].code_line = code_line;
27047  entries[0].code_object = code_object;
27048  Py_INCREF(code_object);
27049  }
27050  return;
27051  }
27052  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
27053  if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
27054  PyCodeObject* tmp = entries[pos].code_object;
27055  entries[pos].code_object = code_object;
27056  Py_DECREF(tmp);
27057  return;
27058  }
27059  if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
27060  int new_max = __pyx_code_cache.max_count + 64;
27061  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
27062  __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
27063  if (unlikely(!entries)) {
27064  return;
27065  }
27066  __pyx_code_cache.entries = entries;
27067  __pyx_code_cache.max_count = new_max;
27068  }
27069  for (i=__pyx_code_cache.count; i>pos; i--) {
27070  entries[i] = entries[i-1];
27071  }
27072  entries[pos].code_line = code_line;
27073  entries[pos].code_object = code_object;
27074  __pyx_code_cache.count++;
27075  Py_INCREF(code_object);
27076 }
27077 
27078 /* AddTraceback */
27079  #include "compile.h"
27080 #include "frameobject.h"
27081 #include "traceback.h"
27082 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
27083  const char *funcname, int c_line,
27084  int py_line, const char *filename) {
27085  PyCodeObject *py_code = 0;
27086  PyObject *py_srcfile = 0;
27087  PyObject *py_funcname = 0;
27088  #if PY_MAJOR_VERSION < 3
27089  py_srcfile = PyString_FromString(filename);
27090  #else
27091  py_srcfile = PyUnicode_FromString(filename);
27092  #endif
27093  if (!py_srcfile) goto bad;
27094  if (c_line) {
27095  #if PY_MAJOR_VERSION < 3
27096  py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
27097  #else
27098  py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
27099  #endif
27100  }
27101  else {
27102  #if PY_MAJOR_VERSION < 3
27103  py_funcname = PyString_FromString(funcname);
27104  #else
27105  py_funcname = PyUnicode_FromString(funcname);
27106  #endif
27107  }
27108  if (!py_funcname) goto bad;
27109  py_code = __Pyx_PyCode_New(
27110  0,
27111  0,
27112  0,
27113  0,
27114  0,
27115  __pyx_empty_bytes, /*PyObject *code,*/
27116  __pyx_empty_tuple, /*PyObject *consts,*/
27117  __pyx_empty_tuple, /*PyObject *names,*/
27118  __pyx_empty_tuple, /*PyObject *varnames,*/
27119  __pyx_empty_tuple, /*PyObject *freevars,*/
27120  __pyx_empty_tuple, /*PyObject *cellvars,*/
27121  py_srcfile, /*PyObject *filename,*/
27122  py_funcname, /*PyObject *name,*/
27123  py_line,
27124  __pyx_empty_bytes /*PyObject *lnotab*/
27125  );
27126  Py_DECREF(py_srcfile);
27127  Py_DECREF(py_funcname);
27128  return py_code;
27129 bad:
27130  Py_XDECREF(py_srcfile);
27131  Py_XDECREF(py_funcname);
27132  return NULL;
27133 }
27134 static void __Pyx_AddTraceback(const char *funcname, int c_line,
27135  int py_line, const char *filename) {
27136  PyCodeObject *py_code = 0;
27137  PyFrameObject *py_frame = 0;
27138  PyThreadState *tstate = __Pyx_PyThreadState_Current;
27139  if (c_line) {
27140  c_line = __Pyx_CLineForTraceback(tstate, c_line);
27141  }
27142  py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
27143  if (!py_code) {
27144  py_code = __Pyx_CreateCodeObjectForTraceback(
27145  funcname, c_line, py_line, filename);
27146  if (!py_code) goto bad;
27147  __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
27148  }
27149  py_frame = PyFrame_New(
27150  tstate, /*PyThreadState *tstate,*/
27151  py_code, /*PyCodeObject *code,*/
27152  __pyx_d, /*PyObject *globals,*/
27153  0 /*PyObject *locals*/
27154  );
27155  if (!py_frame) goto bad;
27156  __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
27157  PyTraceBack_Here(py_frame);
27158 bad:
27159  Py_XDECREF(py_code);
27160  Py_XDECREF(py_frame);
27161 }
27162 
27163 #if PY_MAJOR_VERSION < 3
27164 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
27165  if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
27166  if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
27167  PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
27168  return -1;
27169 }
27170 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
27171  PyObject *obj = view->obj;
27172  if (!obj) return;
27173  if (PyObject_CheckBuffer(obj)) {
27174  PyBuffer_Release(view);
27175  return;
27176  }
27177  if ((0)) {}
27178  else if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view);
27179  view->obj = NULL;
27180  Py_DECREF(obj);
27181 }
27182 #endif
27183 
27184 
27185  /* CIntFromPyVerify */
27186  #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
27187  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
27188 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
27189  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
27190 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
27191  {\
27192  func_type value = func_value;\
27193  if (sizeof(target_type) < sizeof(func_type)) {\
27194  if (unlikely(value != (func_type) (target_type) value)) {\
27195  func_type zero = 0;\
27196  if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
27197  return (target_type) -1;\
27198  if (is_unsigned && unlikely(value < zero))\
27199  goto raise_neg_overflow;\
27200  else\
27201  goto raise_overflow;\
27202  }\
27203  }\
27204  return (target_type) value;\
27205  }
27206 
27207 /* CIntToPy */
27208  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
27209  const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
27210  const int is_unsigned = neg_one > const_zero;
27211  if (is_unsigned) {
27212  if (sizeof(int) < sizeof(long)) {
27213  return PyInt_FromLong((long) value);
27214  } else if (sizeof(int) <= sizeof(unsigned long)) {
27215  return PyLong_FromUnsignedLong((unsigned long) value);
27216 #ifdef HAVE_LONG_LONG
27217  } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
27218  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
27219 #endif
27220  }
27221  } else {
27222  if (sizeof(int) <= sizeof(long)) {
27223  return PyInt_FromLong((long) value);
27224 #ifdef HAVE_LONG_LONG
27225  } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
27226  return PyLong_FromLongLong((PY_LONG_LONG) value);
27227 #endif
27228  }
27229  }
27230  {
27231  int one = 1; int little = (int)*(unsigned char *)&one;
27232  unsigned char *bytes = (unsigned char *)&value;
27233  return _PyLong_FromByteArray(bytes, sizeof(int),
27234  little, !is_unsigned);
27235  }
27236 }
27237 
27238 /* CIntToPy */
27239  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) {
27240  const Py_intptr_t neg_one = (Py_intptr_t) ((Py_intptr_t) 0 - (Py_intptr_t) 1), const_zero = (Py_intptr_t) 0;
27241  const int is_unsigned = neg_one > const_zero;
27242  if (is_unsigned) {
27243  if (sizeof(Py_intptr_t) < sizeof(long)) {
27244  return PyInt_FromLong((long) value);
27245  } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
27246  return PyLong_FromUnsignedLong((unsigned long) value);
27247 #ifdef HAVE_LONG_LONG
27248  } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
27249  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
27250 #endif
27251  }
27252  } else {
27253  if (sizeof(Py_intptr_t) <= sizeof(long)) {
27254  return PyInt_FromLong((long) value);
27255 #ifdef HAVE_LONG_LONG
27256  } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
27257  return PyLong_FromLongLong((PY_LONG_LONG) value);
27258 #endif
27259  }
27260  }
27261  {
27262  int one = 1; int little = (int)*(unsigned char *)&one;
27263  unsigned char *bytes = (unsigned char *)&value;
27264  return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
27265  little, !is_unsigned);
27266  }
27267 }
27268 
27269 /* CIntToPy */
27270  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
27271  const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
27272  const int is_unsigned = neg_one > const_zero;
27273  if (is_unsigned) {
27274  if (sizeof(long) < sizeof(long)) {
27275  return PyInt_FromLong((long) value);
27276  } else if (sizeof(long) <= sizeof(unsigned long)) {
27277  return PyLong_FromUnsignedLong((unsigned long) value);
27278 #ifdef HAVE_LONG_LONG
27279  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
27280  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
27281 #endif
27282  }
27283  } else {
27284  if (sizeof(long) <= sizeof(long)) {
27285  return PyInt_FromLong((long) value);
27286 #ifdef HAVE_LONG_LONG
27287  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
27288  return PyLong_FromLongLong((PY_LONG_LONG) value);
27289 #endif
27290  }
27291  }
27292  {
27293  int one = 1; int little = (int)*(unsigned char *)&one;
27294  unsigned char *bytes = (unsigned char *)&value;
27295  return _PyLong_FromByteArray(bytes, sizeof(long),
27296  little, !is_unsigned);
27297  }
27298 }
27299 
27300 /* Declarations */
27301  #if CYTHON_CCOMPLEX
27302  #ifdef __cplusplus
27303  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
27304  return ::std::complex< float >(x, y);
27305  }
27306  #else
27307  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
27308  return x + y*(__pyx_t_float_complex)_Complex_I;
27309  }
27310  #endif
27311 #else
27312  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
27313  __pyx_t_float_complex z;
27314  z.real = x;
27315  z.imag = y;
27316  return z;
27317  }
27318 #endif
27319 
27320 /* Arithmetic */
27321  #if CYTHON_CCOMPLEX
27322 #else
27323  static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27324  return (a.real == b.real) && (a.imag == b.imag);
27325  }
27326  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27327  __pyx_t_float_complex z;
27328  z.real = a.real + b.real;
27329  z.imag = a.imag + b.imag;
27330  return z;
27331  }
27332  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27333  __pyx_t_float_complex z;
27334  z.real = a.real - b.real;
27335  z.imag = a.imag - b.imag;
27336  return z;
27337  }
27338  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27339  __pyx_t_float_complex z;
27340  z.real = a.real * b.real - a.imag * b.imag;
27341  z.imag = a.real * b.imag + a.imag * b.real;
27342  return z;
27343  }
27344  #if 1
27345  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27346  if (b.imag == 0) {
27347  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
27348  } else if (fabsf(b.real) >= fabsf(b.imag)) {
27349  if (b.real == 0 && b.imag == 0) {
27350  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
27351  } else {
27352  float r = b.imag / b.real;
27353  float s = (float)(1.0) / (b.real + b.imag * r);
27354  return __pyx_t_float_complex_from_parts(
27355  (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
27356  }
27357  } else {
27358  float r = b.real / b.imag;
27359  float s = (float)(1.0) / (b.imag + b.real * r);
27360  return __pyx_t_float_complex_from_parts(
27361  (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
27362  }
27363  }
27364  #else
27365  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27366  if (b.imag == 0) {
27367  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
27368  } else {
27369  float denom = b.real * b.real + b.imag * b.imag;
27370  return __pyx_t_float_complex_from_parts(
27371  (a.real * b.real + a.imag * b.imag) / denom,
27372  (a.imag * b.real - a.real * b.imag) / denom);
27373  }
27374  }
27375  #endif
27376  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
27377  __pyx_t_float_complex z;
27378  z.real = -a.real;
27379  z.imag = -a.imag;
27380  return z;
27381  }
27382  static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
27383  return (a.real == 0) && (a.imag == 0);
27384  }
27385  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
27386  __pyx_t_float_complex z;
27387  z.real = a.real;
27388  z.imag = -a.imag;
27389  return z;
27390  }
27391  #if 1
27392  static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
27393  #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
27394  return sqrtf(z.real*z.real + z.imag*z.imag);
27395  #else
27396  return hypotf(z.real, z.imag);
27397  #endif
27398  }
27399  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27400  __pyx_t_float_complex z;
27401  float r, lnr, theta, z_r, z_theta;
27402  if (b.imag == 0 && b.real == (int)b.real) {
27403  if (b.real < 0) {
27404  float denom = a.real * a.real + a.imag * a.imag;
27405  a.real = a.real / denom;
27406  a.imag = -a.imag / denom;
27407  b.real = -b.real;
27408  }
27409  switch ((int)b.real) {
27410  case 0:
27411  z.real = 1;
27412  z.imag = 0;
27413  return z;
27414  case 1:
27415  return a;
27416  case 2:
27417  return __Pyx_c_prod_float(a, a);
27418  case 3:
27419  z = __Pyx_c_prod_float(a, a);
27420  return __Pyx_c_prod_float(z, a);
27421  case 4:
27422  z = __Pyx_c_prod_float(a, a);
27423  return __Pyx_c_prod_float(z, z);
27424  }
27425  }
27426  if (a.imag == 0) {
27427  if (a.real == 0) {
27428  return a;
27429  } else if (b.imag == 0) {
27430  z.real = powf(a.real, b.real);
27431  z.imag = 0;
27432  return z;
27433  } else if (a.real > 0) {
27434  r = a.real;
27435  theta = 0;
27436  } else {
27437  r = -a.real;
27438  theta = atan2f(0.0, -1.0);
27439  }
27440  } else {
27441  r = __Pyx_c_abs_float(a);
27442  theta = atan2f(a.imag, a.real);
27443  }
27444  lnr = logf(r);
27445  z_r = expf(lnr * b.real - theta * b.imag);
27446  z_theta = theta * b.real + lnr * b.imag;
27447  z.real = z_r * cosf(z_theta);
27448  z.imag = z_r * sinf(z_theta);
27449  return z;
27450  }
27451  #endif
27452 #endif
27453 
27454 /* Declarations */
27455  #if CYTHON_CCOMPLEX
27456  #ifdef __cplusplus
27457  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
27458  return ::std::complex< double >(x, y);
27459  }
27460  #else
27461  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
27462  return x + y*(__pyx_t_double_complex)_Complex_I;
27463  }
27464  #endif
27465 #else
27466  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
27467  __pyx_t_double_complex z;
27468  z.real = x;
27469  z.imag = y;
27470  return z;
27471  }
27472 #endif
27473 
27474 /* Arithmetic */
27475  #if CYTHON_CCOMPLEX
27476 #else
27477  static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27478  return (a.real == b.real) && (a.imag == b.imag);
27479  }
27480  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27481  __pyx_t_double_complex z;
27482  z.real = a.real + b.real;
27483  z.imag = a.imag + b.imag;
27484  return z;
27485  }
27486  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27487  __pyx_t_double_complex z;
27488  z.real = a.real - b.real;
27489  z.imag = a.imag - b.imag;
27490  return z;
27491  }
27492  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27493  __pyx_t_double_complex z;
27494  z.real = a.real * b.real - a.imag * b.imag;
27495  z.imag = a.real * b.imag + a.imag * b.real;
27496  return z;
27497  }
27498  #if 1
27499  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27500  if (b.imag == 0) {
27501  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
27502  } else if (fabs(b.real) >= fabs(b.imag)) {
27503  if (b.real == 0 && b.imag == 0) {
27504  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
27505  } else {
27506  double r = b.imag / b.real;
27507  double s = (double)(1.0) / (b.real + b.imag * r);
27508  return __pyx_t_double_complex_from_parts(
27509  (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
27510  }
27511  } else {
27512  double r = b.real / b.imag;
27513  double s = (double)(1.0) / (b.imag + b.real * r);
27514  return __pyx_t_double_complex_from_parts(
27515  (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
27516  }
27517  }
27518  #else
27519  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27520  if (b.imag == 0) {
27521  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
27522  } else {
27523  double denom = b.real * b.real + b.imag * b.imag;
27524  return __pyx_t_double_complex_from_parts(
27525  (a.real * b.real + a.imag * b.imag) / denom,
27526  (a.imag * b.real - a.real * b.imag) / denom);
27527  }
27528  }
27529  #endif
27530  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
27531  __pyx_t_double_complex z;
27532  z.real = -a.real;
27533  z.imag = -a.imag;
27534  return z;
27535  }
27536  static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
27537  return (a.real == 0) && (a.imag == 0);
27538  }
27539  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
27540  __pyx_t_double_complex z;
27541  z.real = a.real;
27542  z.imag = -a.imag;
27543  return z;
27544  }
27545  #if 1
27546  static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
27547  #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
27548  return sqrt(z.real*z.real + z.imag*z.imag);
27549  #else
27550  return hypot(z.real, z.imag);
27551  #endif
27552  }
27553  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27554  __pyx_t_double_complex z;
27555  double r, lnr, theta, z_r, z_theta;
27556  if (b.imag == 0 && b.real == (int)b.real) {
27557  if (b.real < 0) {
27558  double denom = a.real * a.real + a.imag * a.imag;
27559  a.real = a.real / denom;
27560  a.imag = -a.imag / denom;
27561  b.real = -b.real;
27562  }
27563  switch ((int)b.real) {
27564  case 0:
27565  z.real = 1;
27566  z.imag = 0;
27567  return z;
27568  case 1:
27569  return a;
27570  case 2:
27571  return __Pyx_c_prod_double(a, a);
27572  case 3:
27573  z = __Pyx_c_prod_double(a, a);
27574  return __Pyx_c_prod_double(z, a);
27575  case 4:
27576  z = __Pyx_c_prod_double(a, a);
27577  return __Pyx_c_prod_double(z, z);
27578  }
27579  }
27580  if (a.imag == 0) {
27581  if (a.real == 0) {
27582  return a;
27583  } else if (b.imag == 0) {
27584  z.real = pow(a.real, b.real);
27585  z.imag = 0;
27586  return z;
27587  } else if (a.real > 0) {
27588  r = a.real;
27589  theta = 0;
27590  } else {
27591  r = -a.real;
27592  theta = atan2(0.0, -1.0);
27593  }
27594  } else {
27595  r = __Pyx_c_abs_double(a);
27596  theta = atan2(a.imag, a.real);
27597  }
27598  lnr = log(r);
27599  z_r = exp(lnr * b.real - theta * b.imag);
27600  z_theta = theta * b.real + lnr * b.imag;
27601  z.real = z_r * cos(z_theta);
27602  z.imag = z_r * sin(z_theta);
27603  return z;
27604  }
27605  #endif
27606 #endif
27607 
27608 /* CIntToPy */
27609  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
27610  const enum NPY_TYPES neg_one = (enum NPY_TYPES) ((enum NPY_TYPES) 0 - (enum NPY_TYPES) 1), const_zero = (enum NPY_TYPES) 0;
27611  const int is_unsigned = neg_one > const_zero;
27612  if (is_unsigned) {
27613  if (sizeof(enum NPY_TYPES) < sizeof(long)) {
27614  return PyInt_FromLong((long) value);
27615  } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
27616  return PyLong_FromUnsignedLong((unsigned long) value);
27617 #ifdef HAVE_LONG_LONG
27618  } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
27619  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
27620 #endif
27621  }
27622  } else {
27623  if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
27624  return PyInt_FromLong((long) value);
27625 #ifdef HAVE_LONG_LONG
27626  } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
27627  return PyLong_FromLongLong((PY_LONG_LONG) value);
27628 #endif
27629  }
27630  }
27631  {
27632  int one = 1; int little = (int)*(unsigned char *)&one;
27633  unsigned char *bytes = (unsigned char *)&value;
27634  return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
27635  little, !is_unsigned);
27636  }
27637 }
27638 
27639 /* CIntFromPy */
27640  static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
27641  const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
27642  const int is_unsigned = neg_one > const_zero;
27643 #if PY_MAJOR_VERSION < 3
27644  if (likely(PyInt_Check(x))) {
27645  if (sizeof(int) < sizeof(long)) {
27646  __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
27647  } else {
27648  long val = PyInt_AS_LONG(x);
27649  if (is_unsigned && unlikely(val < 0)) {
27650  goto raise_neg_overflow;
27651  }
27652  return (int) val;
27653  }
27654  } else
27655 #endif
27656  if (likely(PyLong_Check(x))) {
27657  if (is_unsigned) {
27658 #if CYTHON_USE_PYLONG_INTERNALS
27659  const digit* digits = ((PyLongObject*)x)->ob_digit;
27660  switch (Py_SIZE(x)) {
27661  case 0: return (int) 0;
27662  case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
27663  case 2:
27664  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
27665  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
27666  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27667  } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
27668  return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
27669  }
27670  }
27671  break;
27672  case 3:
27673  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
27674  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
27675  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27676  } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
27677  return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
27678  }
27679  }
27680  break;
27681  case 4:
27682  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
27683  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27684  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27685  } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
27686  return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
27687  }
27688  }
27689  break;
27690  }
27691 #endif
27692 #if CYTHON_COMPILING_IN_CPYTHON
27693  if (unlikely(Py_SIZE(x) < 0)) {
27694  goto raise_neg_overflow;
27695  }
27696 #else
27697  {
27698  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
27699  if (unlikely(result < 0))
27700  return (int) -1;
27701  if (unlikely(result == 1))
27702  goto raise_neg_overflow;
27703  }
27704 #endif
27705  if (sizeof(int) <= sizeof(unsigned long)) {
27706  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
27707 #ifdef HAVE_LONG_LONG
27708  } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
27709  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
27710 #endif
27711  }
27712  } else {
27713 #if CYTHON_USE_PYLONG_INTERNALS
27714  const digit* digits = ((PyLongObject*)x)->ob_digit;
27715  switch (Py_SIZE(x)) {
27716  case 0: return (int) 0;
27717  case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
27718  case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
27719  case -2:
27720  if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
27721  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
27722  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27723  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
27724  return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27725  }
27726  }
27727  break;
27728  case 2:
27729  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
27730  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
27731  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27732  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
27733  return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27734  }
27735  }
27736  break;
27737  case -3:
27738  if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
27739  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
27740  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27741  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
27742  return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27743  }
27744  }
27745  break;
27746  case 3:
27747  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
27748  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
27749  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27750  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
27751  return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27752  }
27753  }
27754  break;
27755  case -4:
27756  if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
27757  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27758  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27759  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
27760  return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27761  }
27762  }
27763  break;
27764  case 4:
27765  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
27766  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27767  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27768  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
27769  return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27770  }
27771  }
27772  break;
27773  }
27774 #endif
27775  if (sizeof(int) <= sizeof(long)) {
27776  __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
27777 #ifdef HAVE_LONG_LONG
27778  } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
27779  __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
27780 #endif
27781  }
27782  }
27783  {
27784 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
27785  PyErr_SetString(PyExc_RuntimeError,
27786  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
27787 #else
27788  int val;
27789  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
27790  #if PY_MAJOR_VERSION < 3
27791  if (likely(v) && !PyLong_Check(v)) {
27792  PyObject *tmp = v;
27793  v = PyNumber_Long(tmp);
27794  Py_DECREF(tmp);
27795  }
27796  #endif
27797  if (likely(v)) {
27798  int one = 1; int is_little = (int)*(unsigned char *)&one;
27799  unsigned char *bytes = (unsigned char *)&val;
27800  int ret = _PyLong_AsByteArray((PyLongObject *)v,
27801  bytes, sizeof(val),
27802  is_little, !is_unsigned);
27803  Py_DECREF(v);
27804  if (likely(!ret))
27805  return val;
27806  }
27807 #endif
27808  return (int) -1;
27809  }
27810  } else {
27811  int val;
27812  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27813  if (!tmp) return (int) -1;
27814  val = __Pyx_PyInt_As_int(tmp);
27815  Py_DECREF(tmp);
27816  return val;
27817  }
27818 raise_overflow:
27819  PyErr_SetString(PyExc_OverflowError,
27820  "value too large to convert to int");
27821  return (int) -1;
27822 raise_neg_overflow:
27823  PyErr_SetString(PyExc_OverflowError,
27824  "can't convert negative value to int");
27825  return (int) -1;
27826 }
27827 
27828 /* CIntFromPy */
27829  static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *x) {
27830  const Py_intptr_t neg_one = (Py_intptr_t) ((Py_intptr_t) 0 - (Py_intptr_t) 1), const_zero = (Py_intptr_t) 0;
27831  const int is_unsigned = neg_one > const_zero;
27832 #if PY_MAJOR_VERSION < 3
27833  if (likely(PyInt_Check(x))) {
27834  if (sizeof(Py_intptr_t) < sizeof(long)) {
27835  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, PyInt_AS_LONG(x))
27836  } else {
27837  long val = PyInt_AS_LONG(x);
27838  if (is_unsigned && unlikely(val < 0)) {
27839  goto raise_neg_overflow;
27840  }
27841  return (Py_intptr_t) val;
27842  }
27843  } else
27844 #endif
27845  if (likely(PyLong_Check(x))) {
27846  if (is_unsigned) {
27847 #if CYTHON_USE_PYLONG_INTERNALS
27848  const digit* digits = ((PyLongObject*)x)->ob_digit;
27849  switch (Py_SIZE(x)) {
27850  case 0: return (Py_intptr_t) 0;
27851  case 1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, digit, digits[0])
27852  case 2:
27853  if (8 * sizeof(Py_intptr_t) > 1 * PyLong_SHIFT) {
27854  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
27855  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27856  } else if (8 * sizeof(Py_intptr_t) >= 2 * PyLong_SHIFT) {
27857  return (Py_intptr_t) (((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
27858  }
27859  }
27860  break;
27861  case 3:
27862  if (8 * sizeof(Py_intptr_t) > 2 * PyLong_SHIFT) {
27863  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
27864  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27865  } else if (8 * sizeof(Py_intptr_t) >= 3 * PyLong_SHIFT) {
27866  return (Py_intptr_t) (((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
27867  }
27868  }
27869  break;
27870  case 4:
27871  if (8 * sizeof(Py_intptr_t) > 3 * PyLong_SHIFT) {
27872  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27873  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27874  } else if (8 * sizeof(Py_intptr_t) >= 4 * PyLong_SHIFT) {
27875  return (Py_intptr_t) (((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
27876  }
27877  }
27878  break;
27879  }
27880 #endif
27881 #if CYTHON_COMPILING_IN_CPYTHON
27882  if (unlikely(Py_SIZE(x) < 0)) {
27883  goto raise_neg_overflow;
27884  }
27885 #else
27886  {
27887  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
27888  if (unlikely(result < 0))
27889  return (Py_intptr_t) -1;
27890  if (unlikely(result == 1))
27891  goto raise_neg_overflow;
27892  }
27893 #endif
27894  if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
27895  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, unsigned long, PyLong_AsUnsignedLong(x))
27896 #ifdef HAVE_LONG_LONG
27897  } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
27898  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
27899 #endif
27900  }
27901  } else {
27902 #if CYTHON_USE_PYLONG_INTERNALS
27903  const digit* digits = ((PyLongObject*)x)->ob_digit;
27904  switch (Py_SIZE(x)) {
27905  case 0: return (Py_intptr_t) 0;
27906  case -1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, sdigit, (sdigit) (-(sdigit)digits[0]))
27907  case 1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, digit, +digits[0])
27908  case -2:
27909  if (8 * sizeof(Py_intptr_t) - 1 > 1 * PyLong_SHIFT) {
27910  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
27911  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27912  } else if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
27913  return (Py_intptr_t) (((Py_intptr_t)-1)*(((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
27914  }
27915  }
27916  break;
27917  case 2:
27918  if (8 * sizeof(Py_intptr_t) > 1 * PyLong_SHIFT) {
27919  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
27920  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27921  } else if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
27922  return (Py_intptr_t) ((((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
27923  }
27924  }
27925  break;
27926  case -3:
27927  if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
27928  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
27929  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27930  } else if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
27931  return (Py_intptr_t) (((Py_intptr_t)-1)*(((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
27932  }
27933  }
27934  break;
27935  case 3:
27936  if (8 * sizeof(Py_intptr_t) > 2 * PyLong_SHIFT) {
27937  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
27938  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27939  } else if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
27940  return (Py_intptr_t) ((((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
27941  }
27942  }
27943  break;
27944  case -4:
27945  if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
27946  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27947  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27948  } else if (8 * sizeof(Py_intptr_t) - 1 > 4 * PyLong_SHIFT) {
27949  return (Py_intptr_t) (((Py_intptr_t)-1)*(((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
27950  }
27951  }
27952  break;
27953  case 4:
27954  if (8 * sizeof(Py_intptr_t) > 3 * PyLong_SHIFT) {
27955  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27956  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27957  } else if (8 * sizeof(Py_intptr_t) - 1 > 4 * PyLong_SHIFT) {
27958  return (Py_intptr_t) ((((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
27959  }
27960  }
27961  break;
27962  }
27963 #endif
27964  if (sizeof(Py_intptr_t) <= sizeof(long)) {
27965  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, long, PyLong_AsLong(x))
27966 #ifdef HAVE_LONG_LONG
27967  } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
27968  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, PY_LONG_LONG, PyLong_AsLongLong(x))
27969 #endif
27970  }
27971  }
27972  {
27973 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
27974  PyErr_SetString(PyExc_RuntimeError,
27975  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
27976 #else
27977  Py_intptr_t val;
27978  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
27979  #if PY_MAJOR_VERSION < 3
27980  if (likely(v) && !PyLong_Check(v)) {
27981  PyObject *tmp = v;
27982  v = PyNumber_Long(tmp);
27983  Py_DECREF(tmp);
27984  }
27985  #endif
27986  if (likely(v)) {
27987  int one = 1; int is_little = (int)*(unsigned char *)&one;
27988  unsigned char *bytes = (unsigned char *)&val;
27989  int ret = _PyLong_AsByteArray((PyLongObject *)v,
27990  bytes, sizeof(val),
27991  is_little, !is_unsigned);
27992  Py_DECREF(v);
27993  if (likely(!ret))
27994  return val;
27995  }
27996 #endif
27997  return (Py_intptr_t) -1;
27998  }
27999  } else {
28000  Py_intptr_t val;
28001  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
28002  if (!tmp) return (Py_intptr_t) -1;
28003  val = __Pyx_PyInt_As_Py_intptr_t(tmp);
28004  Py_DECREF(tmp);
28005  return val;
28006  }
28007 raise_overflow:
28008  PyErr_SetString(PyExc_OverflowError,
28009  "value too large to convert to Py_intptr_t");
28010  return (Py_intptr_t) -1;
28011 raise_neg_overflow:
28012  PyErr_SetString(PyExc_OverflowError,
28013  "can't convert negative value to Py_intptr_t");
28014  return (Py_intptr_t) -1;
28015 }
28016 
28017 /* CIntFromPy */
28018  static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
28019  const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
28020  const int is_unsigned = neg_one > const_zero;
28021 #if PY_MAJOR_VERSION < 3
28022  if (likely(PyInt_Check(x))) {
28023  if (sizeof(long) < sizeof(long)) {
28024  __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
28025  } else {
28026  long val = PyInt_AS_LONG(x);
28027  if (is_unsigned && unlikely(val < 0)) {
28028  goto raise_neg_overflow;
28029  }
28030  return (long) val;
28031  }
28032  } else
28033 #endif
28034  if (likely(PyLong_Check(x))) {
28035  if (is_unsigned) {
28036 #if CYTHON_USE_PYLONG_INTERNALS
28037  const digit* digits = ((PyLongObject*)x)->ob_digit;
28038  switch (Py_SIZE(x)) {
28039  case 0: return (long) 0;
28040  case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
28041  case 2:
28042  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
28043  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
28044  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28045  } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
28046  return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
28047  }
28048  }
28049  break;
28050  case 3:
28051  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
28052  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
28053  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28054  } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
28055  return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
28056  }
28057  }
28058  break;
28059  case 4:
28060  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
28061  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
28062  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28063  } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
28064  return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
28065  }
28066  }
28067  break;
28068  }
28069 #endif
28070 #if CYTHON_COMPILING_IN_CPYTHON
28071  if (unlikely(Py_SIZE(x) < 0)) {
28072  goto raise_neg_overflow;
28073  }
28074 #else
28075  {
28076  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
28077  if (unlikely(result < 0))
28078  return (long) -1;
28079  if (unlikely(result == 1))
28080  goto raise_neg_overflow;
28081  }
28082 #endif
28083  if (sizeof(long) <= sizeof(unsigned long)) {
28084  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
28085 #ifdef HAVE_LONG_LONG
28086  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
28087  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
28088 #endif
28089  }
28090  } else {
28091 #if CYTHON_USE_PYLONG_INTERNALS
28092  const digit* digits = ((PyLongObject*)x)->ob_digit;
28093  switch (Py_SIZE(x)) {
28094  case 0: return (long) 0;
28095  case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
28096  case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
28097  case -2:
28098  if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
28099  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
28100  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28101  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
28102  return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
28103  }
28104  }
28105  break;
28106  case 2:
28107  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
28108  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
28109  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28110  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
28111  return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
28112  }
28113  }
28114  break;
28115  case -3:
28116  if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
28117  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
28118  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28119  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
28120  return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
28121  }
28122  }
28123  break;
28124  case 3:
28125  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
28126  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
28127  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28128  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
28129  return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
28130  }
28131  }
28132  break;
28133  case -4:
28134  if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
28135  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
28136  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28137  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
28138  return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
28139  }
28140  }
28141  break;
28142  case 4:
28143  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
28144  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
28145  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28146  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
28147  return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
28148  }
28149  }
28150  break;
28151  }
28152 #endif
28153  if (sizeof(long) <= sizeof(long)) {
28154  __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
28155 #ifdef HAVE_LONG_LONG
28156  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
28157  __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
28158 #endif
28159  }
28160  }
28161  {
28162 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
28163  PyErr_SetString(PyExc_RuntimeError,
28164  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
28165 #else
28166  long val;
28167  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
28168  #if PY_MAJOR_VERSION < 3
28169  if (likely(v) && !PyLong_Check(v)) {
28170  PyObject *tmp = v;
28171  v = PyNumber_Long(tmp);
28172  Py_DECREF(tmp);
28173  }
28174  #endif
28175  if (likely(v)) {
28176  int one = 1; int is_little = (int)*(unsigned char *)&one;
28177  unsigned char *bytes = (unsigned char *)&val;
28178  int ret = _PyLong_AsByteArray((PyLongObject *)v,
28179  bytes, sizeof(val),
28180  is_little, !is_unsigned);
28181  Py_DECREF(v);
28182  if (likely(!ret))
28183  return val;
28184  }
28185 #endif
28186  return (long) -1;
28187  }
28188  } else {
28189  long val;
28190  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
28191  if (!tmp) return (long) -1;
28192  val = __Pyx_PyInt_As_long(tmp);
28193  Py_DECREF(tmp);
28194  return val;
28195  }
28196 raise_overflow:
28197  PyErr_SetString(PyExc_OverflowError,
28198  "value too large to convert to long");
28199  return (long) -1;
28200 raise_neg_overflow:
28201  PyErr_SetString(PyExc_OverflowError,
28202  "can't convert negative value to long");
28203  return (long) -1;
28204 }
28205 
28206 /* FastTypeChecks */
28207  #if CYTHON_COMPILING_IN_CPYTHON
28208 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
28209  while (a) {
28210  a = a->tp_base;
28211  if (a == b)
28212  return 1;
28213  }
28214  return b == &PyBaseObject_Type;
28215 }
28216 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
28217  PyObject *mro;
28218  if (a == b) return 1;
28219  mro = a->tp_mro;
28220  if (likely(mro)) {
28221  Py_ssize_t i, n;
28222  n = PyTuple_GET_SIZE(mro);
28223  for (i = 0; i < n; i++) {
28224  if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
28225  return 1;
28226  }
28227  return 0;
28228  }
28229  return __Pyx_InBases(a, b);
28230 }
28231 #if PY_MAJOR_VERSION == 2
28232 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
28233  PyObject *exception, *value, *tb;
28234  int res;
28235  __Pyx_PyThreadState_declare
28236  __Pyx_PyThreadState_assign
28237  __Pyx_ErrFetch(&exception, &value, &tb);
28238  res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
28239  if (unlikely(res == -1)) {
28240  PyErr_WriteUnraisable(err);
28241  res = 0;
28242  }
28243  if (!res) {
28244  res = PyObject_IsSubclass(err, exc_type2);
28245  if (unlikely(res == -1)) {
28246  PyErr_WriteUnraisable(err);
28247  res = 0;
28248  }
28249  }
28250  __Pyx_ErrRestore(exception, value, tb);
28251  return res;
28252 }
28253 #else
28254 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
28255  int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
28256  if (!res) {
28257  res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
28258  }
28259  return res;
28260 }
28261 #endif
28262 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
28263  Py_ssize_t i, n;
28264  assert(PyExceptionClass_Check(exc_type));
28265  n = PyTuple_GET_SIZE(tuple);
28266 #if PY_MAJOR_VERSION >= 3
28267  for (i=0; i<n; i++) {
28268  if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
28269  }
28270 #endif
28271  for (i=0; i<n; i++) {
28272  PyObject *t = PyTuple_GET_ITEM(tuple, i);
28273  #if PY_MAJOR_VERSION < 3
28274  if (likely(exc_type == t)) return 1;
28275  #endif
28276  if (likely(PyExceptionClass_Check(t))) {
28277  if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
28278  } else {
28279  }
28280  }
28281  return 0;
28282 }
28283 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
28284  if (likely(err == exc_type)) return 1;
28285  if (likely(PyExceptionClass_Check(err))) {
28286  if (likely(PyExceptionClass_Check(exc_type))) {
28287  return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
28288  } else if (likely(PyTuple_Check(exc_type))) {
28289  return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
28290  } else {
28291  }
28292  }
28293  return PyErr_GivenExceptionMatches(err, exc_type);
28294 }
28295 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
28296  assert(PyExceptionClass_Check(exc_type1));
28297  assert(PyExceptionClass_Check(exc_type2));
28298  if (likely(err == exc_type1 || err == exc_type2)) return 1;
28299  if (likely(PyExceptionClass_Check(err))) {
28300  return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
28301  }
28302  return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
28303 }
28304 #endif
28305 
28306 /* CheckBinaryVersion */
28307  static int __Pyx_check_binary_version(void) {
28308  char ctversion[4], rtversion[4];
28309  PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
28310  PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
28311  if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
28312  char message[200];
28313  PyOS_snprintf(message, sizeof(message),
28314  "compiletime version %s of module '%.100s' "
28315  "does not match runtime version %s",
28316  ctversion, __Pyx_MODULE_NAME, rtversion);
28317  return PyErr_WarnEx(NULL, message, 1);
28318  }
28319  return 0;
28320 }
28321 
28322 /* InitStrings */
28323  static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
28324  while (t->p) {
28325  #if PY_MAJOR_VERSION < 3
28326  if (t->is_unicode) {
28327  *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
28328  } else if (t->intern) {
28329  *t->p = PyString_InternFromString(t->s);
28330  } else {
28331  *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
28332  }
28333  #else
28334  if (t->is_unicode | t->is_str) {
28335  if (t->intern) {
28336  *t->p = PyUnicode_InternFromString(t->s);
28337  } else if (t->encoding) {
28338  *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
28339  } else {
28340  *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
28341  }
28342  } else {
28343  *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
28344  }
28345  #endif
28346  if (!*t->p)
28347  return -1;
28348  if (PyObject_Hash(*t->p) == -1)
28349  return -1;
28350  ++t;
28351  }
28352  return 0;
28353 }
28354 
28355 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
28356  return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
28357 }
28358 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
28359  Py_ssize_t ignore;
28360  return __Pyx_PyObject_AsStringAndSize(o, &ignore);
28361 }
28362 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
28363 #if !CYTHON_PEP393_ENABLED
28364 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
28365  char* defenc_c;
28366  PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
28367  if (!defenc) return NULL;
28368  defenc_c = PyBytes_AS_STRING(defenc);
28369 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
28370  {
28371  char* end = defenc_c + PyBytes_GET_SIZE(defenc);
28372  char* c;
28373  for (c = defenc_c; c < end; c++) {
28374  if ((unsigned char) (*c) >= 128) {
28375  PyUnicode_AsASCIIString(o);
28376  return NULL;
28377  }
28378  }
28379  }
28380 #endif
28381  *length = PyBytes_GET_SIZE(defenc);
28382  return defenc_c;
28383 }
28384 #else
28385 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
28386  if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
28387 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
28388  if (likely(PyUnicode_IS_ASCII(o))) {
28389  *length = PyUnicode_GET_LENGTH(o);
28390  return PyUnicode_AsUTF8(o);
28391  } else {
28392  PyUnicode_AsASCIIString(o);
28393  return NULL;
28394  }
28395 #else
28396  return PyUnicode_AsUTF8AndSize(o, length);
28397 #endif
28398 }
28399 #endif
28400 #endif
28401 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
28402 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
28403  if (
28404 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
28405  __Pyx_sys_getdefaultencoding_not_ascii &&
28406 #endif
28407  PyUnicode_Check(o)) {
28408  return __Pyx_PyUnicode_AsStringAndSize(o, length);
28409  } else
28410 #endif
28411 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
28412  if (PyByteArray_Check(o)) {
28413  *length = PyByteArray_GET_SIZE(o);
28414  return PyByteArray_AS_STRING(o);
28415  } else
28416 #endif
28417  {
28418  char* result;
28419  int r = PyBytes_AsStringAndSize(o, &result, length);
28420  if (unlikely(r < 0)) {
28421  return NULL;
28422  } else {
28423  return result;
28424  }
28425  }
28426 }
28427 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
28428  int is_true = x == Py_True;
28429  if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
28430  else return PyObject_IsTrue(x);
28431 }
28432 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
28433  int retval;
28434  if (unlikely(!x)) return -1;
28435  retval = __Pyx_PyObject_IsTrue(x);
28436  Py_DECREF(x);
28437  return retval;
28438 }
28439 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
28440 #if PY_MAJOR_VERSION >= 3
28441  if (PyLong_Check(result)) {
28442  if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
28443  "__int__ returned non-int (type %.200s). "
28444  "The ability to return an instance of a strict subclass of int "
28445  "is deprecated, and may be removed in a future version of Python.",
28446  Py_TYPE(result)->tp_name)) {
28447  Py_DECREF(result);
28448  return NULL;
28449  }
28450  return result;
28451  }
28452 #endif
28453  PyErr_Format(PyExc_TypeError,
28454  "__%.4s__ returned non-%.4s (type %.200s)",
28455  type_name, type_name, Py_TYPE(result)->tp_name);
28456  Py_DECREF(result);
28457  return NULL;
28458 }
28459 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
28460 #if CYTHON_USE_TYPE_SLOTS
28461  PyNumberMethods *m;
28462 #endif
28463  const char *name = NULL;
28464  PyObject *res = NULL;
28465 #if PY_MAJOR_VERSION < 3
28466  if (likely(PyInt_Check(x) || PyLong_Check(x)))
28467 #else
28468  if (likely(PyLong_Check(x)))
28469 #endif
28470  return __Pyx_NewRef(x);
28471 #if CYTHON_USE_TYPE_SLOTS
28472  m = Py_TYPE(x)->tp_as_number;
28473  #if PY_MAJOR_VERSION < 3
28474  if (m && m->nb_int) {
28475  name = "int";
28476  res = m->nb_int(x);
28477  }
28478  else if (m && m->nb_long) {
28479  name = "long";
28480  res = m->nb_long(x);
28481  }
28482  #else
28483  if (likely(m && m->nb_int)) {
28484  name = "int";
28485  res = m->nb_int(x);
28486  }
28487  #endif
28488 #else
28489  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
28490  res = PyNumber_Int(x);
28491  }
28492 #endif
28493  if (likely(res)) {
28494 #if PY_MAJOR_VERSION < 3
28495  if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
28496 #else
28497  if (unlikely(!PyLong_CheckExact(res))) {
28498 #endif
28499  return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
28500  }
28501  }
28502  else if (!PyErr_Occurred()) {
28503  PyErr_SetString(PyExc_TypeError,
28504  "an integer is required");
28505  }
28506  return res;
28507 }
28508 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
28509  Py_ssize_t ival;
28510  PyObject *x;
28511 #if PY_MAJOR_VERSION < 3
28512  if (likely(PyInt_CheckExact(b))) {
28513  if (sizeof(Py_ssize_t) >= sizeof(long))
28514  return PyInt_AS_LONG(b);
28515  else
28516  return PyInt_AsSsize_t(b);
28517  }
28518 #endif
28519  if (likely(PyLong_CheckExact(b))) {
28520  #if CYTHON_USE_PYLONG_INTERNALS
28521  const digit* digits = ((PyLongObject*)b)->ob_digit;
28522  const Py_ssize_t size = Py_SIZE(b);
28523  if (likely(__Pyx_sst_abs(size) <= 1)) {
28524  ival = likely(size) ? digits[0] : 0;
28525  if (size == -1) ival = -ival;
28526  return ival;
28527  } else {
28528  switch (size) {
28529  case 2:
28530  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
28531  return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
28532  }
28533  break;
28534  case -2:
28535  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
28536  return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
28537  }
28538  break;
28539  case 3:
28540  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
28541  return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
28542  }
28543  break;
28544  case -3:
28545  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
28546  return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
28547  }
28548  break;
28549  case 4:
28550  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
28551  return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
28552  }
28553  break;
28554  case -4:
28555  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
28556  return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
28557  }
28558  break;
28559  }
28560  }
28561  #endif
28562  return PyLong_AsSsize_t(b);
28563  }
28564  x = PyNumber_Index(b);
28565  if (!x) return -1;
28566  ival = PyInt_AsSsize_t(x);
28567  Py_DECREF(x);
28568  return ival;
28569 }
28570 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
28571  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
28572 }
28573 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
28574  return PyInt_FromSize_t(ival);
28575 }
28576 
28577 
28578 #endif /* Py_PYTHON_H */
Double c
Definition: Headers.h:53
Double f
Definition: Headers.h:53
double pos(double a)
Double * z
Definition: Headers.h:40
Int n
Definition: Headers.h:27
Double s
Definition: Headers.h:53
Int number
Definition: Headers.h:27
Double u
Definition: Headers.h:53
Double v
Definition: Headers.h:53
Double r
Definition: Headers.h:53
Double T
Definition: Headers.h:53